Creates a new instance of ErrorHandler.
Descriptive error message.
Optional
statusCode: number = 500HTTP status code (default is 500).
Optional
type: string = 'GENERIC_ERROR'Error type.
Optional
details: Record<string, unknown>Additional error details (optional).
Optional
detailsAdditional error details (optional).
Descriptive error message.
HTTP status code associated with the error.
Indicates if the response was successful (always false
for errors).
Error type.
Converts the error instance to a JSON object compatible with the ErrorResponse interface.
Serializable error object.
Custom error handler class for the application.
Extends the base
Error
class and allows defining errors with additional information such as type, HTTP status code, message, and optional details.Example