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

feat(errors): Turn manualy raised unprocessable_entity errors into ValidationFailure #457

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

vincent-pochet
Copy link
Collaborator

Context

Error handling in services and the way it's rendered in API and GraphQL needs a complete refactoring.

Description

The objective of this pull request is to normalize the way services return data validation errors.

When a service action cannot be performed because the custom pre-conditions are not met, the service keeps returning a failed error as it was doing before. But instead of a list of error codes and custom "unprocessable entity we are now building a BaseService::ValidationFailure with a list of error messages for each fields (or base if not for a specific field) and we attach it as the error field of the result object.

This new behavior is now used in the custom service validators

NOTE: The result of wallet validators changed a bit, it as an impact on the front end and should be fixed before the merge

@vincent-pochet vincent-pochet added API Related to the public API GraphQL Related to the GraphQL API labels Sep 14, 2022
@vincent-pochet vincent-pochet self-assigned this Sep 14, 2022
@vincent-pochet vincent-pochet merged commit 7e56c7a into main Sep 15, 2022
@vincent-pochet vincent-pochet deleted the feature/unprocessable-entity branch September 15, 2022 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to the public API GraphQL Related to the GraphQL API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants