Skip to content

ERROR_CODE_POLICY

Associate an error handling policy with the endpoint.

Keywords

error_code_policy_name, error_code_policy, error_code

Syntax

error_code_policy <policy-name>
error_code <policy-name>

Examples

Named Policy

sql
comment on function risky_operation() is
'HTTP POST
error_code_policy strict_errors';

Short Form

sql
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

Released under the MIT License.