Verified

API Error Handler

A Verified Samchil module for standard JSON API error responses with safe defaults for TypeScript services.

Store listing is live for Polar checkout. GitHub repository access is handled by the Polar-connected repository benefit after confirmed payment.

Public API

  • Creates standard JSON API error responses for TypeScript services.
  • Normalizes status, code, public message, optional details, and request id fields.
  • Preserves existing ApiError instances and converts unknown errors with a generic public response by default.

Input and schema behavior

  • Unknown errors use a generic public message by default.
  • Raw messages, stack traces, and causes are not exposed in the public response by default.
  • The package does not install framework middleware by itself.

Secret redaction

  • Redaction applies to details passed through this module.
  • Secret-like detail keys and configured raw values are redacted in normalized details.
  • The module does not inspect arbitrary application logs, tracing, metrics, or alerting output.