GtdError class

A comprehensive error handling class for network requests that standardizes error reporting across the application.

Implemented types

Constructors

GtdError({required String message, int? statusCode, String? errorCode, GtdError? originalError, StackTrace? stackTrace})
GtdError.custom(String message, {int? statusCode, String? errorCode})
Creates a GtdError with a custom message
factory
GtdError.fromDioError(DioException dioError)
Factory constructor to create GtdError from DioException
factory
GtdError.fromError(GtdError error, {required String message, required String errorCode})
Creates a GtdError from another GtdError, preserving the original stacktrace
factory
GtdError.fromException(dynamic exception, [StackTrace? stackTrace])
Creates a GtdError from a generic exception
factory

Properties

errorCode String?
Error code for categorizing errors
final
hashCode int
The hash code for this object.
no setterinherited
message String
Error message to display to the user
final
originalError GtdError?
Original error that caused this exception
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace?
Stack trace for debugging
final
statusCode int?
HTTP status code if available
final

Methods

getOriginalErrorSource() → dynamic
Recursively gets the original error source from a chain of GtdError objects
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDetailedString() String
Returns a detailed diagnostic message for debugging, including stack trace
toString() String
Returns a human-readable string representation of the error
override

Operators

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