FeathersError
The base class for all Feathers errors.string | Error | object
required
The error message or an error object
string
required
The error name (e.g.,
'BadRequest')number
required
The HTTP status code (e.g.,
400)string
required
The class name in kebab-case (e.g.,
'bad-request')any
Additional error data
Properties
string
Always
'FeathersError'number
The HTTP status code
string
The error class name in kebab-case
any
Additional error data
any
Validation errors or sub-errors
Methods
toJSON()
Serialize the error to JSON:Error Classes
All error classes extendFeathersError and follow the same constructor pattern:
4xx Client Errors
BadRequest (400)
General client error.NotAuthenticated (401)
User is not authenticated.PaymentError (402)
Payment required or payment failed.Forbidden (403)
User is authenticated but not authorized.NotFound (404)
Resource not found.MethodNotAllowed (405)
HTTP method not allowed.NotAcceptable (406)
Requested format is not available.Timeout (408)
Request timeout.Conflict (409)
Request conflicts with current state.Gone (410)
Resource is permanently gone.LengthRequired (411)
Content-Length header required.Unprocessable (422)
Request is well-formed but contains semantic errors.TooManyRequests (429)
Rate limit exceeded.5xx Server Errors
GeneralError (500)
General server error.NotImplemented (501)
Feature not implemented.BadGateway (502)
Bad gateway or upstream server error.Unavailable (503)
Service temporarily unavailable.Error Object Formats
Error Message Types
JSON Format
Error Handling
In Hooks
In Services
With Try/Catch
Converting Errors
Convert plain error objects to Feathers errors:any
required
Error object or value to convert
Error
A FeathersError instance if the error name matches, otherwise a generic Error