AdapterException class

适配器异常基类,统一不同网络库的异常类型 Adapter exception base class, which unifies exception types for different network libraries

继承自 RxError,与框架异常体系统一:

  • 可以被 catch (RxError) 捕获
  • 可以被 catch (AdapterException) 精确捕获
  • 保留了结构化的 type 和 statusCode 信息
Inheritance

Constructors

AdapterException({required String message, required AdapterExceptionType type, int? statusCode, AdapterResponse? response, dynamic originalError, StackTrace? stackTrace})
AdapterException.cancel({String? message, dynamic originalError, StackTrace? stackTrace})
创建取消异常 Create cancellation exception
factory
AdapterException.connectionError({String? message, dynamic originalError, StackTrace? stackTrace})
创建连接错误异常 Create connection error exception
factory
AdapterException.connectTimeout({String? message, dynamic originalError, StackTrace? stackTrace})
创建连接超时异常 Create connection timeout exception
factory
AdapterException.receiveTimeout({String? message, dynamic originalError, StackTrace? stackTrace})
创建接收超时异常 Create receive timeout exception
factory
AdapterException.response({required int statusCode, String? message, AdapterResponse? response, dynamic originalError, StackTrace? stackTrace})
创建响应错误异常 Create response error exception
factory
AdapterException.sendTimeout({String? message, dynamic originalError, StackTrace? stackTrace})
创建发送超时异常 Create send timeout exception
factory
AdapterException.unknown({String? message, dynamic originalError, StackTrace? stackTrace})
创建未知错误异常 Create unknown error exception
factory

Properties

cause → dynamic
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
message → String
finalinherited
originalError → dynamic
原始错误对象 Original error object
final
response → AdapterResponse?
响应对象(如果有) Responding object (if any)
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace → StackTrace?
堆栈跟踪 stack trace
final
statusCode → int?
HTTP 状态码(如果有) HTTP status code (if any)
final
type → AdapterExceptionType
异常类型 exception type
final

Methods

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