eoussama/anusic-api

Semantic responses for errors

Closed this issue · 1 comments

There needs to be a constant, predictable object that contains the data and some additional info.
Something like this:

{
    "hasError": false,
    "error": { "name": "", "description": "" },
    "data": {}
}

Errors:

  • Invalid route
  • Invalid ID (Invalid data type passed as an ID)
  • Unknown ID (MAL ID does not match anything cached.

Provide an error middleware.