Error Message Configuration Guide
This page provides a centralized explanation of all layers, working principles and priority order of the error message configuration system in Apinizer. All error message customization methods across policies, routing and platform-wide settings are covered here.
Multi-Layered Configuration System
Apinizer allows you to configure error messages at four different levels. Each level can override the level above it. This way, you can define a consistent error behavior across the platform while returning completely different responses for specific policies or error types.
Configuration Levels
| Level | Configuration Location | Scope | Purpose |
|---|---|---|---|
| 1. Platform-Wide | System Settings > Error Messages | All API Proxies and policies | Define standard error format across the organization |
| 2. API Proxy / Proxy Group | API Proxy Settings | Specific API Proxy or group | Define API-specific error response template (JSON/XML) |
| 3. Policy / Routing | Policy or routing update screen | Specific policy or routing address | Define policy-specific error message and template |
| 4. Per-Error | Error row in policy or platform-wide screen | Specific error type | Customized response for a single error type |
This multi-layered structure provides the flexibility to handle everything from a simple "show the same message for all errors" requirement to complex "return different responses for different error types based on different conditions" scenarios.
Error Message Priority Order
When an error occurs, the Gateway determines which error response to return based on the following priority order. The response of the first matching level is used; lower levels are not evaluated.
| Priority | Source | Description |
|---|---|---|
| 1 (Highest) | Per-error custom message template | Template-based custom message builder defined for a specific error type in policy, routing or platform-wide settings |
| 2 | Policy / routing-level custom message template | Template-based custom message builder defined at policy or routing level (for all error types) |
| 3 | Error response rules | Condition-based response rules — return different error responses based on request information (path, header, method, etc.) |
| 4 | Per-error field customization | Row-level Customized Message, Customized Error Code, Customized HTTP Status Code fields in policy, routing or platform-wide settings |
| 5 | Platform-wide error message customization | Customizations made from System Settings > Error Messages page |
| 6 (Lowest) | Default error message | Default error message defined by the system |
If a higher-priority source is defined, lower-priority sources are not evaluated. For example, if a custom message template is active for an error row, the policy-level template, error response rules, or row-level field customizations are not considered.
Workflow: How an Error Becomes a Response
Below is a summary of the steps from when an error occurs to when it is returned to the end user:
Step 1: Error Occurs
An error occurs during policy, routing or API Proxy processing (e.g., authentication failed, quota exceeded, schema validation failed, etc.).
Step 2: Default Values Determined
The system determines the default HTTP status code, error code and error message corresponding to the error type.