Skip to content

Not standardized response on error #4

Closed
@ramoncardena

Description

@ramoncardena

When fetching data from the backend you got a response object. When there are errors the object is called 'errors' and if the errors are from validation, you get an array with the location, param, value and msg.

The problem is with POST /register, when you send an incorrect email like "asdasd@asdas" you don't get the validation error object, just a plain error object:

Object
errors: msg: "User validation failed: email: EMAIL_IS_NOT_VALID"
proto: Objec
t__proto__: Object

Instead of:

Object
errors:
msg: Array(1)
0: {location: "body", param: "email", value: "asdasd@asdas", msg: "EMAIL_IS_NOT_VALID"}
length: 1
proto: Array(0)
proto: Object
proto: Object

On the other hand, if you send an invalid email in POST /login you get the right validation error.

It's possible to standardize all errors to just get WHATEVER_WHATEVER (like IS_EMPTY)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions