Skip to content

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

@mattias-p

Description

@mattias-p

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions