Error Handling
Error Response Structure
The API adheres to a standardized error response format to ensure consistent communication of errors. Below is a breakdown of the fields and examples:
Fields in Error Response:
type: A URI reference to the documentation about the type of error.
title: A short, human-readable summary of the problem type.
status: The HTTP status code applicable to this error.
traceId: A unique identifier for the error occurrence, helpful for debugging and tracing logs.
errors: A dictionary containing detailed error messages from different layers of the application.
Explanation of the errors
Dictionary
The errors
field is designed to provide granular error details across the application's layers. This dictionary includes keys that specify the layer and function where the error occurred, with corresponding error messages.
business: Represents errors from the business logic layer.
engine: Represents errors from the engine or lower-level operations.
Examples
Example 1: Business and Engine Layer Errors
This example highlights errors occurring first in the engine layer (AdCreativesByTemplates
function) and subsequently propagated to the business layer. Each layer adds its error details to the errors
dictionary.
Example 2: Validation Error
This example demonstrates a validation error, where an invalid value for applicationId
results in a failure.
Example 3: Timeout Error
This example demonstrates a timeout error in the business layer, where an HTTP request exceeded the configured timeout.
Summary
The structured error format provides transparency and actionable details for debugging and issue resolution, aiding developers in pinpointing and addressing issues efficiently.
Last updated