AngelHttpException class

Exception class that can be serialized to JSON and serialized to clients. Carries HTTP-specific metadata, like statusCode.

Originally inspired by feathers-errors.

Implemented types

Constructors

AngelHttpException(dynamic error, {String message = '500 Internal Server Error', StackTrace? stackTrace, int statusCode = 500, List<String> errors = const []})
AngelHttpException.badRequest({String message = '400 Bad Request', List<String> errors = const []})
Throws a 400 Bad Request error, including an optional arrray of (validation?) errors you specify.
factory
AngelHttpException.conflict({String message = '409 Conflict'})
Throws a 409 Conflict error.
factory
AngelHttpException.forbidden({String message = '403 Forbidden'})
Throws a 403 Forbidden error.
factory
AngelHttpException.fromJson(String str)
factory
AngelHttpException.fromMap(Map data)
factory
AngelHttpException.methodNotAllowed({String message = '405 Method Not Allowed'})
Throws a 405 Method Not Allowed error.
factory
AngelHttpException.methodTimeout({String message = '408 Timeout'})
Throws a 408 Timeout error.
factory
AngelHttpException.notAcceptable({String message = '406 Not Acceptable'})
Throws a 406 Not Acceptable error.
factory
AngelHttpException.notAuthenticated({String message = '401 Not Authenticated'})
Throws a 401 Not Authenticated error.
factory
AngelHttpException.notFound({String message = '404 Not Found'})
Throws a 404 Not Found error.
factory
AngelHttpException.notImplemented({String message = '501 Not Implemented'})
Throws a 501 Not Implemented error.
factory
AngelHttpException.notProcessable({String message = '422 Not Processable'})
Throws a 422 Not Processable error.
factory
AngelHttpException.paymentRequired({String message = '402 Payment Required'})
Throws a 402 Payment Required error.
factory
AngelHttpException.unavailable({String message = '503 Unavailable'})
Throws a 503 Unavailable error.
factory

Properties

error ↔ dynamic
getter/setter pair
errors List<String>
A list of errors that occurred when this exception was thrown.
final
hashCode int
The hash code for this object.
no setterinherited
message String
The cause of this exception.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace?
The StackTrace associated with this error.
getter/setter pair
statusCode int
An HTTP status code this exception will throw.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map
toMap() Map
toString() String
A string representation of this object.
override

Operators

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