Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 798 Bytes

error.md

File metadata and controls

26 lines (19 loc) · 798 Bytes

Errors

Purpose of Errors

  1. To represent remote Errors.
  2. To enable graceful fallback.
  3. To conform to Javascript standards.

Error properties

  • name - A high level summary of what went wrong.
  • message - A more detailed message of specifically what went wrong.
  • status - The HTTP response code, useful for distinguishing between user errors or API bugs.
  • code - Useful for debugging the remote API, should assist development teams to track down bugs.
> console.log(someError);
{ [Requested resource does not exist: "There is no people with id 5e7b30d5-c8da-4936-9f81-4a6ea1153a5f"]
  name: 'Requested resource does not exist',
  status: '404',
  code: 'ENOTFOUND' }