Lune Docs Logo
Log inContact us

Error handling

Lune returns errors with an HTTP status code, a Lune-specific error_code, and an error message. Additionally, errors include a CF-Ray header, which can be reported to Lune for troubleshooting.The following example shows a sample error object:
  • Sample error object
  • The current error response also includes an errors array. This array is deprecated. Please refer only to the error JSON object for guidance.
  • Handling errors in Lune

    See below for some tips on handling errors when working with the Lune API:
    • HTTP 4XX errors: Use the error.message to determine how to correct the request.
    • HTTP 5XX errors: Retry the request. If the error persists, please contact us.
      • If the issue is a timeout or connection error, retries will not create duplicate orders or calculations. Lune employs idempotency keys to prevent unintended duplicates.
    • HTTP 404 errors: The requested resource does not exist. Verify your request and endpoint parameters.
    • HTTP 429 errors: You have exceeded the rate limit. Wait before retrying.

    Error codes

    Lune provides various error_code values to simplify error handling. These are typically paired with 4XX HTTP status codes (for example, 400, 409, 422).The most common error is validation_error (paired with a HTTP status code of 400), returned when a request does not meet validation requirements. The response message specifies which properties are invalid.For endpoint-specific errors, refer to the API reference for that endpoint.