Class ApiError
This class encapsulates error information returned by the Interledger API when requests fail. It provides both a human-readable description and a machine-readable error code for programmatic error handling.
API errors are typically returned as JSON responses with HTTP status codes indicating the type of error (4xx for client errors, 5xx for server errors). The error object is wrapped in an "error" root element as specified by the JSON serialization configuration.
Example error response:
{
"error": {
"code": "invalid_request",
"description": "The request is missing required parameters"
}
}
- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionUnique error code for programmatic error handling.Human-readable error description. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
description
Human-readable error description.Provides a detailed explanation of what went wrong with the request. This field is intended for developers and debugging purposes, offering context about the error condition.
Examples:
- "The request is missing required parameters"
- "Invalid authentication credentials"
- "The requested resource was not found"
- "Internal server error occurred"
-
code
Unique error code for programmatic error handling.Provides a machine-readable identifier for the specific error condition. Error codes allow applications to handle different types of errors programmatically without parsing error descriptions.
Common error codes include:
- "invalid_request" - Malformed or missing required parameters
- "unauthorized" - Authentication required or invalid credentials
- "forbidden" - Access denied for the requested resource
- "not_found" - Requested resource does not exist
- "internal_error" - Server-side error occurred
-
-
Constructor Details
-
ApiError
public ApiError()
-