Creates a new UnauthorizedError instance with optional details.
Optional
details: Record<string, unknown>Additional error details related to the authentication failure.
Creates a new UnauthorizedError instance with a custom message, type, and optional details.
Optional
message: stringA custom error message describing the authentication issue.
Optional
type: UnauthorizedErrorTypeA specific unauthorized error type identifier.
Optional
details: Record<string, unknown>Additional error details.
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.
Represents a generic unauthorized error (HTTP 401).
This error is thrown when the request requires user authentication but the client has failed to provide valid credentials.
Can be instantiated with either a custom message, type, and optional details, or directly with a
details
object.