LiterLlmError class sealed

Available extensions
Annotations
  • @freezed

Constructors

LiterLlmError.authentication({required String message, required PlatformInt64 status})
status preserves the exact HTTP status code received (401 or 403).
const
factory
LiterLlmError.badRequest({required String message, required PlatformInt64 status})
status preserves the exact HTTP status code received (400, 405, 413, 422, …).
const
factory
LiterLlmError.budgetExceeded({required String message, required String model})
const
factory
LiterLlmError.contentPolicy({required String message})
const
factory
LiterLlmError.contextWindowExceeded({required String message})
const
factory
LiterLlmError.endpointNotSupported({required String endpoint, required String provider})
const
factory
LiterLlmError.hookRejected({required String message})
const
factory
LiterLlmError.idempotencyConflict({required String key})
A different request body was submitted for an existing Idempotency-Key.
const
factory
LiterLlmError.idempotencyInFlight({required String key})
The same Idempotency-Key is already in-flight (another request with the same key is currently being processed).
const
factory
LiterLlmError.internalError({required String message})
An internal logic error (e.g. unexpected Tower response variant).
const
factory
LiterLlmError.invalidHeader({required String name, required String reason})
const
factory
LiterLlmError.notFound({required String message})
const
factory
LiterLlmError.outboundForbidden({required String url, required String reason})
An outbound request was blocked by the active OutboundPolicy.
const
factory
LiterLlmError.rateLimited({required String message, required PlatformInt64 retryAfter})
const
factory
LiterLlmError.serialization({required String field0})
const
factory
LiterLlmError.serverError({required String message, required PlatformInt64 status})
status preserves the exact HTTP status code received (500, or other 5xx not covered by ServiceUnavailable).
const
factory
LiterLlmError.serviceUnavailable({required String message, required PlatformInt64 status})
status preserves the exact HTTP status code received (502, 503, or 504).
const
factory
LiterLlmError.streaming({required String message})
A catch-all for errors that occur during streaming response processing.
const
factory
LiterLlmError.timeout()
const
factory

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

errorType() Future<String>
Return the OpenTelemetry error.type string for this error variant.
isTransient() Future<bool>
Returns true for errors that are worth retrying on a different service or deployment (transient failures).
map<TResult extends Object?>({required TResult authentication(LiterLlmError_Authentication value), required TResult rateLimited(LiterLlmError_RateLimited value), required TResult badRequest(LiterLlmError_BadRequest value), required TResult contextWindowExceeded(LiterLlmError_ContextWindowExceeded value), required TResult contentPolicy(LiterLlmError_ContentPolicy value), required TResult notFound(LiterLlmError_NotFound value), required TResult serverError(LiterLlmError_ServerError value), required TResult serviceUnavailable(LiterLlmError_ServiceUnavailable value), required TResult timeout(LiterLlmError_Timeout value), required TResult streaming(LiterLlmError_Streaming value), required TResult endpointNotSupported(LiterLlmError_EndpointNotSupported value), required TResult invalidHeader(LiterLlmError_InvalidHeader value), required TResult serialization(LiterLlmError_Serialization value), required TResult budgetExceeded(LiterLlmError_BudgetExceeded value), required TResult hookRejected(LiterLlmError_HookRejected value), required TResult internalError(LiterLlmError_InternalError value), required TResult outboundForbidden(LiterLlmError_OutboundForbidden value), required TResult idempotencyConflict(LiterLlmError_IdempotencyConflict value), required TResult idempotencyInFlight(LiterLlmError_IdempotencyInFlight value)}) → TResult

Available on LiterLlmError, provided by the LiterLlmErrorPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>({TResult? authentication(LiterLlmError_Authentication value)?, TResult? rateLimited(LiterLlmError_RateLimited value)?, TResult? badRequest(LiterLlmError_BadRequest value)?, TResult? contextWindowExceeded(LiterLlmError_ContextWindowExceeded value)?, TResult? contentPolicy(LiterLlmError_ContentPolicy value)?, TResult? notFound(LiterLlmError_NotFound value)?, TResult? serverError(LiterLlmError_ServerError value)?, TResult? serviceUnavailable(LiterLlmError_ServiceUnavailable value)?, TResult? timeout(LiterLlmError_Timeout value)?, TResult? streaming(LiterLlmError_Streaming value)?, TResult? endpointNotSupported(LiterLlmError_EndpointNotSupported value)?, TResult? invalidHeader(LiterLlmError_InvalidHeader value)?, TResult? serialization(LiterLlmError_Serialization value)?, TResult? budgetExceeded(LiterLlmError_BudgetExceeded value)?, TResult? hookRejected(LiterLlmError_HookRejected value)?, TResult? internalError(LiterLlmError_InternalError value)?, TResult? outboundForbidden(LiterLlmError_OutboundForbidden value)?, TResult? idempotencyConflict(LiterLlmError_IdempotencyConflict value)?, TResult? idempotencyInFlight(LiterLlmError_IdempotencyInFlight value)?}) → TResult?

Available on LiterLlmError, provided by the LiterLlmErrorPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>({TResult authentication(LiterLlmError_Authentication value)?, TResult rateLimited(LiterLlmError_RateLimited value)?, TResult badRequest(LiterLlmError_BadRequest value)?, TResult contextWindowExceeded(LiterLlmError_ContextWindowExceeded value)?, TResult contentPolicy(LiterLlmError_ContentPolicy value)?, TResult notFound(LiterLlmError_NotFound value)?, TResult serverError(LiterLlmError_ServerError value)?, TResult serviceUnavailable(LiterLlmError_ServiceUnavailable value)?, TResult timeout(LiterLlmError_Timeout value)?, TResult streaming(LiterLlmError_Streaming value)?, TResult endpointNotSupported(LiterLlmError_EndpointNotSupported value)?, TResult invalidHeader(LiterLlmError_InvalidHeader value)?, TResult serialization(LiterLlmError_Serialization value)?, TResult budgetExceeded(LiterLlmError_BudgetExceeded value)?, TResult hookRejected(LiterLlmError_HookRejected value)?, TResult internalError(LiterLlmError_InternalError value)?, TResult outboundForbidden(LiterLlmError_OutboundForbidden value)?, TResult idempotencyConflict(LiterLlmError_IdempotencyConflict value)?, TResult idempotencyInFlight(LiterLlmError_IdempotencyInFlight value)?, required TResult orElse()}) → TResult

Available on LiterLlmError, provided by the LiterLlmErrorPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>({TResult authentication(String message, PlatformInt64 status)?, TResult rateLimited(String message, PlatformInt64 status)?, TResult badRequest(String message, PlatformInt64 status)?, TResult contextWindowExceeded(String message)?, TResult contentPolicy(String message)?, TResult notFound(String message)?, TResult serverError(String message, PlatformInt64 status)?, TResult serviceUnavailable(String message, PlatformInt64 status)?, TResult timeout()?, TResult streaming(String message)?, TResult endpointNotSupported(String endpoint, String provider)?, TResult invalidHeader(String endpoint, String provider)?, TResult serialization(String message)?, TResult budgetExceeded(String endpoint, String provider)?, TResult hookRejected(String message)?, TResult internalError(String message)?, TResult outboundForbidden(String endpoint, String provider)?, TResult idempotencyConflict(String message)?, TResult idempotencyInFlight(String message)?, required TResult orElse()}) → TResult

Available on LiterLlmError, provided by the LiterLlmErrorPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
statusCode() Future<PlatformInt64>
Returns the canonical HTTP status code associated with this error.
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult authentication(String message, PlatformInt64 status), required TResult rateLimited(String message, PlatformInt64 status), required TResult badRequest(String message, PlatformInt64 status), required TResult contextWindowExceeded(String message), required TResult contentPolicy(String message), required TResult notFound(String message), required TResult serverError(String message, PlatformInt64 status), required TResult serviceUnavailable(String message, PlatformInt64 status), required TResult timeout(), required TResult streaming(String message), required TResult endpointNotSupported(String endpoint, String provider), required TResult invalidHeader(String endpoint, String provider), required TResult serialization(String message), required TResult budgetExceeded(String endpoint, String provider), required TResult hookRejected(String message), required TResult internalError(String message), required TResult outboundForbidden(String endpoint, String provider), required TResult idempotencyConflict(String message), required TResult idempotencyInFlight(String message)}) → TResult

Available on LiterLlmError, provided by the LiterLlmErrorPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>({TResult? authentication(String message, PlatformInt64 status)?, TResult? rateLimited(String message, PlatformInt64 status)?, TResult? badRequest(String message, PlatformInt64 status)?, TResult? contextWindowExceeded(String message)?, TResult? contentPolicy(String message)?, TResult? notFound(String message)?, TResult? serverError(String message, PlatformInt64 status)?, TResult? serviceUnavailable(String message, PlatformInt64 status)?, TResult? timeout()?, TResult? streaming(String message)?, TResult? endpointNotSupported(String endpoint, String provider)?, TResult? invalidHeader(String endpoint, String provider)?, TResult? serialization(String message)?, TResult? budgetExceeded(String endpoint, String provider)?, TResult? hookRejected(String message)?, TResult? internalError(String message)?, TResult? outboundForbidden(String endpoint, String provider)?, TResult? idempotencyConflict(String message)?, TResult? idempotencyInFlight(String message)?}) → TResult?

Available on LiterLlmError, provided by the LiterLlmErrorPatterns extension

A variant of when that fallback to returning null

Operators

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