MCPcopy Create free account
hub / github.com/Effect-TS/effect / RateLimitError

Class RateLimitError

packages/effect/src/unstable/ai/AiError.ts:372–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370 * @since 4.0.0
371 */
372export class RateLimitError extends Schema.Error<RateLimitError>(
373 "effect/ai/AiError/RateLimitError"
374)({
375 _tag: Schema.tag("RateLimitError"),
376 retryAfter: Schema.optional(Schema.Duration),
377 metadata: providerMetadataWithDefaults<RateLimitErrorMetadata>(),
378 http: Schema.optional(HttpContext)
379}) {
380 /**
381 * Marks `RateLimitError` as a semantic AI error reason for runtime guards.
382 *
383 * @since 4.0.0
384 */
385 readonly [ReasonTypeId] = ReasonTypeId
386
387 /**
388 * Rate limit errors are always retryable.
389 *
390 * @since 4.0.0
391 */
392 get isRetryable(): boolean {
393 return true
394 }
395
396 override get message(): string {
397 let msg = "Rate limit exceeded"
398 if (this.retryAfter) msg += `. Retry after ${Duration.format(this.retryAfter)}`
399 return msg
400 }
401}
402
403/**
404 * Error indicating account or billing limits have been reached.

Callers

nothing calls this directly

Calls 2

tagMethod · 0.65

Tested by

no test coverage detected