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

Unify error codes / messages #25

Open
2 tasks done
TristonianJones opened this issue May 9, 2018 · 1 comment
Open
2 tasks done

Unify error codes / messages #25

TristonianJones opened this issue May 9, 2018 · 1 comment
Labels
cleanup Feature could be improved for ease of maintenance or understanding P3

Comments

@TristonianJones
Copy link
Collaborator

Issue Filing Checklist

  • There are no issues that match the desired change
  • The change is large enough it can't be addressed with a simple Pull Request

Change

Error messages are formatted strings which are not uniform. While this was
okay for development, the errors should be consolidated into error codes
with a set of associated details. Further, when multiple errors are encountered
they should be aggregated together rather than simply picking the first one.

Proposed error codes:

Code Details Description
ATTRIBUTE_NOT_FOUND type, attribute Map or object access using an unknown attribute.
DIVIDE_BY_ZERO n/a Division by zero, also reported for modulus operations.
DUPLICATE_ATTRIBUTE attribute name Map or object construction supplies same key value more than once.
IDENTIFIER_NOT_FOUND identifier name Variable or function name could not be found.
INVALID_ARGUMENT argument value Invalid argument supplied to a function.
OVERLOAD_NOT_FOUND function signature Function defined, but no matching overload found.
TYPE_NOT_FOUND type name Type definition could not be found.

Example

return types.NewError(errors.ATTRIBUTE_NOT_FOUND, value.Type(), field)
@TristonianJones TristonianJones added the cleanup Feature could be improved for ease of maintenance or understanding label Dec 7, 2018
@sefk sefk added the P3 label Dec 10, 2018
@TristonianJones TristonianJones added this to the CEL Go v0.2.0 milestone Jan 30, 2019
@TristonianJones TristonianJones modified the milestones: CEL Go v0.2.0, CEL Go v0.3.0 Mar 13, 2019
@TristonianJones TristonianJones modified the milestones: CEL Go v0.3.0, CEL Go v0.4.0 Apr 24, 2019
@TristonianJones TristonianJones removed this from the CEL v0.8.0 milestone Feb 11, 2021
@josephschorr
Copy link

Hi @TristonianJones, any updates on this? We would find it incredibly useful to be able to provide better errors messages when CEL evaluation fails.

Happy to help if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Feature could be improved for ease of maintenance or understanding P3
Projects
None yet
Development

No branches or pull requests

3 participants