DefaultErrorClassifier class
The framework-free base classifier mapping common Dart exception shapes to
KoelError subtypes. Web-safe by design: it never imports dart:io or
package:http (koel_core is the six-platform kernel — web has no dart:io,
architecture §D4).
dart:io/package:http failures (SocketException, HandshakeException,
HttpException, ClientException) are matched by runtime type name
rather than by is against the imported type. The caveat: a future SDK
rename of one of those long-stable types would silently slip through to the
KoelErrorCode.unknown bucket. That tradeoff buys web-safety with zero
dependencies and is acceptable for these types.
Note the is-vs-name asymmetry: the is TimeoutException/is FormatException arms catch subclasses, but the name-match arms recognize
only the exact bare names — so a renamed or private-impl subtype (e.g. a
_SocketException wrapper) is missed and routes to KoelErrorCode.unknown
even though it is a SocketException. The native koel_http
TransportErrorClassifier closes this on the real transport path with is
checks; the base accepts it as the price of web-safety.
Status-code-aware refinement (HTTP 429 → KoelErrorCode.businessRateLimited,
401 → KoelErrorCode.businessAuth, 403 → KoelErrorCode.businessForbidden)
is not this classifier's job — it belongs to koel_http/adapter
subclasses (Epic 4/5), which may import dart:io and inspect status codes.
The base maps raw exception shapes only.
- Implemented types
Constructors
- DefaultErrorClassifier()
-
Const default constructor.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
classify(
Object raw, StackTrace? stack, RunAgentInput input) → KoelError -
Classifies
raw(with itsstackand the originatinginput) into a typed KoelError. Implementations must not throw — every input, however exotic, must return a non-null KoelError.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited