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.

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
read / write
errors → List<String>
A list of errors that occurred when this exception was thrown.
final
message ↔ String
The cause of this exception.
read / write
stackTrace ↔ StackTrace
The StackTrace associated with this error.
read / write
statusCode ↔ int
An HTTP status code this exception will throw.
read / write
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

toJson() → Map
toMap() → Map
toString() → String
Returns a string representation of this object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited

Operators

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