Skip to content

Latest commit

 

History

History
72 lines (54 loc) · 1.76 KB

File metadata and controls

72 lines (54 loc) · 1.76 KB
outline
2
3
title ERROR_CODE_POLICY Annotation
titleTemplate NpgsqlRest
description Associate error handling policies with PostgreSQL REST API endpoints. Map PostgreSQL errors to custom HTTP responses.
head
meta
name content
keywords
npgsqlrest error policy, postgresql error handling, custom error responses, error code mapping
meta
property content
og:title
NpgsqlRest ERROR_CODE_POLICY Annotation
meta
property content
og:description
Associate error handling policies for custom PostgreSQL error responses.
meta
property content
og:type
article

ERROR_CODE_POLICY

::: info 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

Related Annotations

See Also