Skip to content

Consistent Error Responses  #17

@Jehfkemsy

Description

@Jehfkemsy

Is your feature request related to a problem? Please describe.
I can't provide concise error messages on the front-end.
I'm not sure what responses to expect from the API other than success or failure...let's establish a convention

Describe the solution you'd like

  • Route
    • Failed?
      - Stop at 1st encountered error
      - return What went wrong in ~3 words?
    • success?
    • return success

Reminder: keep response.data schema consistent

  • Faillure
    { ... data: { success: boolean, error: string } ... }

  • Success
    { ... /*where any is the type of the expected response value...*/ data: { success: boolean, data: any } ... }

Targeting routes
- create
- read
- readOne
- update
- confirm
- apply
- unconfirm
- login
- forgotPassword
- resetPassword
- checkIn
- accept
- remindApply
- emailConfirmation
- remindConfirm
- resend

Additional context

  • Consider creating an object of common errors which will help to stay consistent and prevent typos from breaking the server

  • Consider looking into this http-errors
    seems pretty helpful

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions