Rejection class final

A typed extraction failure.

Body failures keep their own status codes rather than collapsing into one 400: 415 for the wrong media type, 400 for malformed syntax, 422 for a well-formed body of the wrong shape, 413 past the size limit.

return const Err(Rejection.unauthorized('missing bearer token'));
Implemented types

Constructors

Rejection.badRequest(String message)
A 400 rejection, used for malformed syntax and failed coercion.
const
Rejection.conflict(String message)
A 409 rejection.
const
Rejection.forbidden(String message)
A 403 rejection.
const
Rejection.internal([String message = 'Internal server error'])
A 500 rejection.
const
Rejection.methodNotAllowed(String message)
A 405 rejection.
const
Rejection.notFound(String message)
A 404 rejection.
const
Rejection.payloadTooLarge(String message)
A 413 rejection, used when a body exceeds the configured limit.
const
Rejection.status(int status, String message)
A rejection with an explicit status code.
const
Rejection.unauthorized(String message, {String challenge = 'Bearer'})
A 401 rejection.
const
Rejection.unprocessable(Map<String, List<String>> fields, {String message = 'Unprocessable entity'})
A 422 rejection carrying per-field errors.
const
Rejection.unsupportedMediaType(String message)
A 415 rejection, used when content-type does not match the extractor.
const

Properties

challenge → String?
The WWW-Authenticate challenge, set on a 401 only.
final
fields → Map<String, List<String>>
Per-field errors, empty unless this is a 422.
final
hashCode → int
The hash code for this object.
no setterinherited
message → String
The human-readable message.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → int
The HTTP status code this rejection encodes to.
final

Methods

intoResponse() → Response
Builds the response for this value.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited