httperr

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResponseErrorL

func ResponseErrorL(c *wkhttp.Context, code codes.Code, params i18n.Params, details i18n.Details)

ResponseErrorL is the business-facing localized error facade.

It validates the code, separates Params from Details, preserves the legacy HTTP/body status=400 compatibility path (D14), and delegates translation/envelope rendering to the injected wkhttp.ErrorRenderer.

ResponseErrorL writes the response but does not abort the gin chain. Handlers must return immediately after calling it, or call c.Abort() when used inside middleware.

func ResponseErrorLWithStatus added in v1.6.0

func ResponseErrorLWithStatus(c *wkhttp.Context, code codes.Code, params i18n.Params, details i18n.Details)

ResponseErrorLWithStatus is the localized error facade for endpoints that intentionally keep their real HTTP transport status instead of the legacy compatibility 400 (D14).

Use this ONLY for endpoints that have NO legacy clients depending on the fixed-400 behavior. Current consumers:

  • the OIDC self-service bind flow (modules/oidc/api_bind.go) — always returned semantic codes (400/401/409/410/422/429/503);
  • the Octo-link Bot bind/unbind endpoints (modules/botfather/api_user.go, POST/DELETE /v1/user/bots/:bot_id/bind) — new endpoints that must return real REST status (404/409/…) so external Agents branch on the wire code.

The body envelope is byte-for-byte identical to ResponseErrorL; only the transport status differs — here it equals the code's canonical HTTPStatus, so the wire status and error.http_status agree. For every other (legacy-bearing) endpoint use ResponseErrorL, which keeps wire=400 during the compatibility window; the fleet-wide switch to real status codes happens once in Phase 4.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL