-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve REST API error readability #237
Comments
tsandall
added a commit
to tsandall/opa
that referenced
this issue
Feb 16, 2017
- Refactor error codes to use strings instead of ints. - Simplify error messages throughout. - Ensure location set on all expressions. There were a couple locations in the parser/compiler where locations were not being set. - Fallback to rule location in topdown in case location not set. This ensures that users get useful locations for API requests with paths that refer to virtual docs exactly. Also add Find function to ast.Value. Useful for extracting values dynamically. Eventually can support JSON pointers. Fixes open-policy-agent#237
tsandall
added a commit
that referenced
this issue
Feb 16, 2017
- Refactor error codes to use strings instead of ints. - Simplify error messages throughout. - Ensure location set on all expressions. There were a couple locations in the parser/compiler where locations were not being set. - Fallback to rule location in topdown in case location not set. This ensures that users get useful locations for API requests with paths that refer to virtual docs exactly. Also add Find function to ast.Value. Useful for extracting values dynamically. Eventually can support JSON pointers. Fixes #237
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Errors returned by the API currently use integer codes as type hints.
The reason for this is simply that Go makes it relatively easy to define a suite of error codes as integers. It would be nicer if the errors returned in the REST API were human readable, e.g., instead of
{"code": 1, ...}
the error was{"code": "rego_runtime_error", ...}
etc.The text was updated successfully, but these errors were encountered: