Skip to main content

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 message
  • error_description (string, optional) - Detailed error description
  • message (string, optional) - Alternative message field
  • detail (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:

CodeStatusUser Message
400Bad Request"Invalid request. Please check your input."
401Unauthorized"Authentication required. Please log in again."
403Forbidden"You do not have permission to perform this action."
404Not Found"The requested resource was not found."
422Unprocessable Entity"Validation error. Please check your input."
429Too Many Requests"Too many requests. Please try again later."
500Internal Server Error"Server error. Please try again later."
503Service Unavailable"Service temporarily unavailable. Please try again later."

Error Message Extraction

The application extracts error messages in this order:

  1. response.data.error
  2. response.data.message
  3. HTTP status code default message
  4. error.message
  5. 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