AsyncError class

Sendable error type that can cross isolate boundaries.

When async operations execute in background isolates, regular OdbcError objects cannot cross isolate boundaries directly. AsyncError provides a sendable alternative that preserves all error information and can be converted back to OdbcError after crossing the isolate boundary.

Example:

try {
  return await Isolate.run(() => native.connect(dsn));
} catch (e) {
  if (e is AsyncError) rethrow;
  throw AsyncError(
    code: AsyncErrorCode.connectionFailed,
    message: e.toString(),
  );
}

See also:

Implemented types

Constructors

AsyncError({required AsyncErrorCode code, required String message, String? sqlState, int? nativeCode})
Creates a new AsyncError with the given properties.
const

Properties

code → AsyncErrorCode
The error code categorizing the type of failure.
final
hashCode → int
The hash code for this object.
no setterinherited
message → String
Human-readable error message.
final
nativeCode → int?
Database-specific native error code (if available).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sqlState → String?
SQLSTATE code from the ODBC driver (if available).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toOdbcError() → OdbcError
Converts this AsyncError to the corresponding OdbcError domain type.
toString() → String
A string representation of this object.
override

Operators

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