Skip to content

Bad request exception message format  #195

@arifszn

Description

@arifszn

Currently, the starter kit returns a bad request exception(400) message details in the following pattern.

"message": [
    "name must be a string",
    "name should not be empty",
    "email must be an email",
    "email should not be empty"
],

There is no specification of the field for which the error has occurred. Then how would the frontend know in which field the error message should be displayed? How about returning the error messages like this? Or any better format?

"message": {
    "name": [
        "name must be a string",
        "name should not be empty",
    ],
    "email": [
        "email must be an email",
        "email should not be empty",
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions