Error Handling
Clasp utilizes standard HTTP response codes to succinctly communicate the status of API requests. The codes are categorized to reflect the nature of the response:
-
2xx
Range: Indicates success. The request was successfully received, understood, and accepted. -
4xx
Range: Signifies client errors. These codes point to issues with the request made by the client. -
5xx
Range: Represents server errors. These are errors on Clasp’s side, and we strive to resolve them promptly.
Error Schema
Errors returned by Clasp follow a structured format to aid in understanding and resolution:
type
(string): Identifies the error type.message
(string): Provides a detailed description of the error and suggestions for resolution.input_errors
(list): An optional list that, if applicable, includes objects detailing errors related to specific input fields. Each object contains:field
(string): The field associated with the error.field_path
(string): The hierarchical path to the erroneous field.message
(string): Explanation of the error related to the field.
Example Error Response
In cases where an API request fails due to specific input errors, Clasp returns a detailed JSON error response. For instance, attempting to update a resource with incomplete data might yield the following error: