ERROR_CODE_POLICY
Also known as
error_code_policy, error_code (with or without @ prefix)
Associate an error handling policy with the endpoint.
Syntax
@error_code_policy <policy-name>
@error_code <policy-name>Examples
Named Policy
comment on function risky_operation() is
'HTTP POST
@error_code_policy strict_errors';Short Form
comment on function api_endpoint() is
'HTTP GET
@error_code default_policy';Behavior
- References an error policy defined in the ErrorCodePolicies configuration
- Controls how PostgreSQL errors are mapped to HTTP status codes
- Defines error response format
Related
- Error Handling configuration - Configure error code policies
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works
Related Annotations
- SECURITY_SENSITIVE - Hide error details