Error Handling
API error responses in the Scriptix API.
Error Response Format
Based on the BaseError type, API errors return this structure:
{
"error": "Error message",
"error_description": "Detailed error description",
"message": "Alternative message field",
"detail": "Additional details"
}
Fields:
error(string) - Primary error messageerror_description(string, optional) - Detailed error descriptionmessage(string, optional) - Alternative message fielddetail(string, optional) - Additional error details
Note: Not all fields are present in every error response.
HTTP Status Codes
The application handles these HTTP status codes:
| Code | Status | User Message |
|---|---|---|
| 400 | Bad Request | "Invalid request. Please check your input." |
| 401 | Unauthorized | "Authentication required. Please log in again." |
| 403 | Forbidden | "You do not have permission to perform this action." |
| 404 | Not Found | "The requested resource was not found." |
| 422 | Unprocessable Entity | "Validation error. Please check your input." |
| 429 | Too Many Requests | "Too many requests. Please try again later." |
| 500 | Internal Server Error | "Server error. Please try again later." |
| 503 | Service Unavailable | "Service temporarily unavailable. Please try again later." |
Error Message Extraction
The application extracts error messages in this order:
response.data.errorresponse.data.message- HTTP status code default message
error.message- Fallback: "An unexpected error occurred. Please try again."
Validation Errors (422)
422 errors with an error field are automatically converted to Yup ValidationError by the Axios response interceptor.
Authentication Errors (401)
When a 401 error occurs (except on shared document pages), the application:
- Automatically logs out the user
- Removes the authentication token
- Redirects to the login page
Errors NOT Logged to Sentry
The following errors are not logged to Sentry:
- 400 Bad Request
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- Network errors (code:
ERR_NETWORK)
Errors NOT Shown to User
The following errors are not shown as toast notifications:
- Network errors (code:
ERR_NETWORK) - 401 Unauthorized errors
- Timeout errors (code:
ECONNABORTED)
Support
For assistance with errors, contact: support@scriptix.io
Related Documentation
- Authentication - Authentication setup and errors
- API Overview - API introduction