Error response payload

Error response payloads should follow a consistent structure. For instance, the payload should be a JSON object with an array of error objects, each containing three fields:

  • code: A numeric error code, to be used by the program
  • message: A short, human-readable summary of the error
  • description: An optional longer, more detailed description of the error

Every error payload must follow this format. This allows developers to write a single function that can process all error messages.

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.