ApiException<T> class

An exception thrown by the API client.

This is a wrapper around the underlying network exceptions. This is used to provide a standard exception type for clients to handle.

The generic T is the parsed body of the error response, as declared by the operation's default: (or error) response in the OpenAPI spec. For operations that do not declare a typed error body, T is dynamic and body is always null.

Implemented types
Annotations
  • @immutable

Constructors

ApiException(int code, String? message, {T? body})
const
ApiException.unhandled(int code)
const
ApiException.withInner(int code, String? message, Exception? innerException, StackTrace? stackTrace)
const

Properties

body → T?
The parsed error body, if the operation's default: response declared a schema. Null otherwise.
final
code → int
final
hashCode → int
The hash code for this object.
no setterinherited
innerException → Exception?
final
message → String?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace → StackTrace?
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