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

Make it possible to distinguish between user errors and API contract violations #1376

Open
mattias-p opened this issue Jul 22, 2024 · 0 comments

Comments

@mattias-p
Copy link
Member

The $profile->set() method raises exceptions for both illegal profile property values and API contract violations. In an application we want to handle these to cases differently. Errors resulting from illegal property values should be reported back to the user (in case the value was provided by a user), but other errors should be logged as internal errors.

Today code that calls $profile->set() doesn't have a good way to distinguish between user errors and internal errors.

The $profile-set() API should be updated with a robust way to distinguish validation errors from API contract errors.

Since this allows callers to do something new this change is at least minor. One way to implement it in a non-breaking way would be to wrap the API contract violation exceptions in a special error class with the "" operator overloaded.

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