Error structure (RFC 9457)
All errors follow the RFC 9457 standard:Error fields
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | General error code (e.g., CLIENT_INVALID_PARAMS) |
sub_type | string | No | Endpoint-specific error code (e.g., GEOCODING_API_NOT_CONFIGURED) |
doc_url | string | No | Link to documentation about this error |
title | string | Yes | Short, human-readable summary |
detail | object | Yes | Detailed description with description field |
status | number | Yes | HTTP status code |
instance | string | Yes | The endpoint path that was called |
errors | array | No | Array of field-specific errors |
Error codes
Error codes are defined ininternal/common/clients/errors.go:
Server errors (5xx)
| Code | HTTP Status | Description |
|---|---|---|
SERVER_INTERNAL_ERROR | 500 | Generic server error |
SERVER_FAILED_TO_READ_BODY | 500 | Failed to read request body |
SERVER_TIMED_OUT | 504 | Request timed out |
SERVER_NOT_IMPLEMENTED | 501 | Feature not implemented |
Client errors (4xx)
| Code | HTTP Status | Description |
|---|---|---|
CLIENT_BAD_REQUEST | 400 | Generic bad request |
CLIENT_MISSING_PARAMS | 400 | Missing query parameters |
CLIENT_INVALID_PARAMS | 400 | Invalid query parameters |
CLIENT_MISSING_REQUEST_BODY | 400 | Request body is required but missing |
CLIENT_INVALID_REQUEST_BODY | 400 | Request body is malformed or invalid |
CLIENT_UNAUTHORIZED | 401 | Missing or invalid API key |
CLIENT_FORBIDDEN | 403 | Missing required role |
CLIENT_RESOURCE_NOT_FOUND | 404 | Resource doesn’t exist |
CLIENT_CONFLICT | 409 | Resource conflict (e.g., duplicate) |
Creating error handlers
Each feature should have ahandler_errors.go file that defines its specific errors.