Skip to content

Add an error reason for caveat parameter type errors#42

Merged
josephschorr merged 1 commit intoauthzed:mainfrom
josephschorr:caveat-param-type-error
Oct 18, 2022
Merged

Add an error reason for caveat parameter type errors#42
josephschorr merged 1 commit intoauthzed:mainfrom
josephschorr:caveat-param-type-error

Conversation

@josephschorr
Copy link
Copy Markdown
Member

@josephschorr josephschorr commented Oct 17, 2022

Will be used if the client sends a parameter value for a caveat that cannot be converted to the expected type

@josephschorr josephschorr force-pushed the caveat-param-type-error branch from fc8f07f to cf626db Compare October 17, 2022 16:12
// "expected_type": "int",
// }
// }
ERROR_REASON_CAVEAT_PARAMETER_TYPE_ERROR = 11;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to have one error type for type errors and just include the additional details in the metadata?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, no. In this case: it is a type error with the usage of the caveat, rather than the definition of the schema. It will have different fields, and different semantics

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this similar to the ERROR_REASON_INVALID_SUBJECT_TYPE above it which is also an error with the usage of a subject rather than the definition?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No; the subject type is valid, but the context parameter is not; they are different errors with different metadata returned

@josephschorr josephschorr merged commit 583b2cc into authzed:main Oct 18, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants