ResponseError class

Error information class

Provides details of an error after the execution of an API call. It should be instantiated in every response object when there is an error of some sort during the execution. All the API responses should return a class extending APIResponse which stores in APIResponse.error and instance of ResponseError

Constructors

ResponseError({required ErrorCode code, required String message, String? context, String? target})
Builds a ResponseError
ResponseError.aborted({required String message, String? context, String? target})
Builds a aborted ResponseError with ErrorCode.aborted and:
ResponseError.authentication({required String message, String? context, String? target})
Builds a authentication ResponseError with ErrorCode.authentication and:
ResponseError.authorization({required String message, String? context, String? target})
Builds a authorization ResponseError with ErrorCode.authorization and:
ResponseError.backendResponse({required String message, String? context, String? target})
Builds a backend response ResponseError with ErrorCode.backendResponse and:
ResponseError.backendStatus({required String message, String? context, String? target})
Builds a backend status ResponseError with ErrorCode.backendStatus and:
ResponseError.backendTimeout({required String message, String? context, String? target})
Builds a backend timeout ResponseError with ErrorCode.backendTimeout and:
ResponseError.conflict({required String message, String? context, String? target})
Builds a conflict ResponseError with ErrorCode.conflict and:
ResponseError.fromJson(Map<String, dynamic> json)
Creates a ResponseError from json map
factory
ResponseError.notFound({required String message, String? context, String? target})
Builds a not found ResponseError with ErrorCode.notFound and:
ResponseError.unknown({required String message, String? context, String? target})
Builds a unknown ResponseError with ErrorCode.unknown and:
ResponseError.unprocessableEntity({required String message, String? context, String? target})
Builds a unprocessable entity ResponseError with ErrorCode.unprocessableEntity and:

Properties

code ErrorCode
The error code
getter/setter pair
context String?
The context of execution when the error occurred
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
message String
The error message
getter/setter pair
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
target String?
The target entity of the API that triggered this error
getter/setter pair

Methods

copyWith({ErrorCode? code, String? message, String? context, String? target}) ResponseError
Builds a copy of a ResponseError
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Creates a json map from a ResponseError
toString() String
A string representation of this object.
inherited

Operators

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