Skip to content

Interface: ResourcefulFormattedError

Standardized error response format used by the ResourcefulErrorMiddleware. Provides consistent structure for all API error responses with support for field-level validation details and error chaining.

Example

typescript
const formattedError: ResourcefulFormattedError = {
  status: 422,
  code: "E_VALIDATION_ERROR",
  message: "Validation failed",
  help: "Check the provided field values",
  details: [
    {
      code: "E_REQUIRED",
      message: "The email field is required",
      target: "email",
    },
  ],
};

Properties

PropertyTypeDescription
codestringMachine-readable error code
details?ResourcefulFormattedErrorDetails[]Array of detailed error information, typically for validation errors
help?stringOptional help text providing guidance on how to resolve the error
messagestringHuman-readable error message
statusnumberHTTP status code for the error response