Skip to content
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

Closed
tsandall opened this issue Jan 31, 2017 · 0 comments
Closed

Improve REST API error readability #237

tsandall opened this issue Jan 31, 2017 · 0 comments

Comments

@tsandall
Copy link
Member

tsandall commented Jan 31, 2017

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.

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant