This document outlines the standard approach for handling errors in our API responses. Our error responses are structured in a JSON format, providing clear and actionable information to the client.

Error Response Format

Errors are returned in a consistent structure, making it easier for clients to parse and take appropriate actions. Here's the structure of our standard error response:

    "errors": [
            "message": "You don't have access to this store",
            "name": "ReportedError",
            "key": "errors_store_access",
            "path": []

Fields Description

  • errors: An array of error objects.
    • message: A human-readable message providing more details about the error.
    • name: The name of the error, typically a broad classification like ReportedError.
    • key: A unique identifier for the error, useful for client-side parsing.
    • path: An array that indicates the location of the error, typically used for form validation errors.

Handling Errors

  1. Parse Error Response: Always check for the errors field in the response.
  2. Identify Error Type: Use the key or name to identify the type of error.
  3. User Communication: Display the message to the user if it's intended for them.
  4. Logging and Monitoring: Log the error details for monitoring and debugging purposes.
  5. Conditional Logic: Implement conditional logic based on key to handle specific errors uniquely.