Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Support user-defined error codes #41

Closed
wants to merge 1 commit into from

Conversation

Erikvv
Copy link

@Erikvv Erikvv commented Jul 18, 2018

This allows the client code to supply his own domain-specific error codes. In my case these were expired account, disabled account, and password not set up.

It is also necessary for the client to supplement $this->messageTemplates and extend the Result class but this is already possible.

  • Are you creating a new feature?

    • Why is the new feature needed? What purpose does it serve?
    • How will users use the new feature?
    • Base your feature on the develop branch, and submit against that branch.
    • Add only one feature per pull request; split multiple features over multiple pull requests
    • Add tests for the new feature. => is this applicable?
    • Add documentation for the new feature. => is this applicable?
    • Add a CHANGELOG.md entry for the new feature.
  • Is this related to quality assurance?
    Yes. Because my users are often confused by the generic error message when they can't log in

This allows the client code to supply his own domain-specific error codes. In my case these were expired account, disabled account, and password not set up.

It is also necessary for the client to supplement $this->messageTemplates and extend the Result class but this is already possible.
@Erikvv
Copy link
Author

Erikvv commented Jul 18, 2018

This was the easiest way to extend it but it's a bit convoluted.

The result error code is mapped to validator error code which is mapped to a message template which is overridden by a message if supplied.

The messages in the Result object were and are still ignored by the validator.

Alternative suggestions are welcome.

@Xerkus
Copy link
Member

Xerkus commented May 14, 2019

Implemented with #47

@Xerkus Xerkus closed this May 14, 2019
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.

2 participants