HatangException class

An error reported by the Hatang gateway (REST or socket) or by the SDK itself.

code is the stable slug the gateway uses (invalid_app_key, rate_limit_exceeded, validation_error, ...). SDK-side failures use network_error, timeout, closed and decode_error.

Implemented types

Constructors

HatangException(String code, String message, {int? status})
Creates an exception with a stable code, a human message and the HTTP status when one applies.
const
HatangException.closed()
A socket request whose connection closed before a reply came.
const
HatangException.network(String message)
A request that never reached the gateway (DNS, TLS, offline).
const
HatangException.timeout()
A socket request that received no reply in time.
const

Properties

code → String
Stable error slug.
final
hashCode → int
The hash code for this object.
no setterinherited
isAppKeyError → bool
The app key is missing, wrong or revoked: no retry will help.
no setter
isRateLimit → bool
The gateway asked the client to slow down.
no setter
isTokenError → bool
The visitor token is no longer accepted (reset elsewhere, revoked).
no setter
isTransient → bool
Worth retrying later (transport trouble, rate limits, server errors).
no setter
message → String
English message meant for logs; the UI translates code instead.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → int?
HTTP status when the error came from a REST call.
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