You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When registering a builtin with the older topdown.RegisterFunctionalBuiltinX helpers the returned error is always checked and wrapped as needed with a topdown.Error. These errors have some nice additions like location info and a standard look/feel. All of the builtin functions should have error messages that have a similar look and feel.
Actual Behavior
The newer topdown.RegisterBuiltinFunc doesn't do any function wrapping, so any builtin functions that use it no longer get their errors wrapped unless they explicity return topdown.Error's with appropriate info.
The current result is that a there are a mix of error types returned by builtin functions and a user hitting errors will see different style of error messaging depending on the builtin.
The older RegisterFunctionalBuiltinX functions would do this and it
gave the builtin error messaging/typing a nice uniform look and feel.
This changes the newer RegisterBuiltinFunc to do the same thing, so
any builtin will now either return a nil error or a `*topdown.Error`.
With an appropriate code, location, and message.
Fixes: open-policy-agent#2101
Signed-off-by: Patrick East <east.patrick@gmail.com>
The older RegisterFunctionalBuiltinX functions would do this and it
gave the builtin error messaging/typing a nice uniform look and feel.
This changes the newer RegisterBuiltinFunc to do the same thing, so
any builtin will now either return a nil error or a `*topdown.Error`.
With an appropriate code, location, and message.
Fixes: #2101
Signed-off-by: Patrick East <east.patrick@gmail.com>
Expected Behavior
When registering a builtin with the older
topdown.RegisterFunctionalBuiltinX
helpers the returned error is always checked and wrapped as needed with atopdown.Error
. These errors have some nice additions like location info and a standard look/feel. All of the builtin functions should have error messages that have a similar look and feel.Actual Behavior
The newer
topdown.RegisterBuiltinFunc
doesn't do any function wrapping, so any builtin functions that use it no longer get their errors wrapped unless they explicity returntopdown.Error
's with appropriate info.The current result is that a there are a mix of error types returned by builtin functions and a user hitting errors will see different style of error messaging depending on the builtin.
Steps to Reproduce the Problem
Additional Info
We should still be able to wrap the function call like we are doing now to normalize the error type returned.
The text was updated successfully, but these errors were encountered: