Error Handling

The Verodat API has a robust error-handling mechanism to provide clear and consistent responses for various exceptions. This document outlines the error handling strategy, including the types of exceptions handled and the corresponding HTTP status codes returned by the API.

Exception Handling Overview

The central class in Verodat is responsible for managing exceptions and generating appropriate HTTP responses. Below are the key points for error handling:

  1. Default Response Format: All error responses are formatted as JSON.
  2. HTTP Status Codes: Specific HTTP status codes are associated with different types of exceptions.
  3. Localized Error Messages: Error messages are localized based on the user's locale. It is handled at many places but not all the places. When It is not handle , English language message would be displayed.

Common Exceptions and Their Responses

ValidationException

• Description: Thrown when there are validation errors.
• HTTP Status Code: 422 Unprocessable Entity
• Response Structure:
{
"message": [
"Error message 1",
"Error message 2",
...
][
"Error message 1",
"Error message 2",
...
]
}

LicenseLimitationException

• Description: Thrown when there is a license limitation.
• HTTP Status Code: 400 Bad Request
• Response Structure
{
"statusCode": 400,
"message": "Specific license limitation error message"
}

LicenseExpiredException

• Description: Thrown when the license has expired.
• HTTP Status Code: 403 Forbidden
• Response Structure
{
"statusCode": 403,
"accountId": "<account_id>",
"message": "License has expired"
}

TESCompilationException

• Description: Thrown when there are syntax errors in mapping or dataset rules.
• HTTP Status Code: 400 Bad Request
• Response Structure:
{
"statusCode": 400,
"message": "Mapping or dataset rules contain syntax errors: <parsed_message>"
}

TESSecurityException

• Description: Thrown for security-related issues.
• HTTP Status Code: 400 Bad Request
• Response Structure
{
"statusCode": 400,
"message": "<security_exception_description>"
}

MultipleCompilationErrorsException

• Description: Thrown when there are multiple compilation errors.
• HTTP Status Code: 400 Bad Request
• Response Structure:
{
"statusCode": 400,
"message": "<parsed_message>"
}

MappingNotUniqueException

• Description: Thrown when a mapping name is not unique.
• HTTP Status Code: 409 Conflict
• Response Structure:
{
"statusCode": 409,
"message": "Mapping name should be unique"
}

LicenseNotValidException

• Description: Thrown when the license is not valid.
• HTTP Status Code: 404 Not Found

AccessDeniedException

• Description: Thrown when access is denied.
• HTTP Status Code: 403 Forbidden

ObjectNotFoundException, EntityNotFoundException

• Description: Thrown when an object or entity is not found.
• HTTP Status Code: 404 Not Found

WorkflowException

• Description: Thrown when there are workflow-related errors.
• HTTP Status Code: 400 Bad Request

ObjectExistsException

• Description: Thrown when an object already exists.
• HTTP Status Code: 409 Conflict

General Exception Handling

• Description: Handles any other exceptions not explicitly covered.
• HTTP Status Code: 400 Bad Request
• Response Structure
{
"showStackTrace": false,
"statusCode": 400,
"message": "<exception_message>",
"exception": "<exception_details>"
}