MCPcopy Index your code
hub / github.com/pmxt-dev/pmxt / mapRateLimitError

Method mapRateLimitError

core/src/utils/error-mapper.ts:256–267  ·  view source on GitHub ↗

* Maps rate limit errors

(message: string, response: unknown)

Source from the content-addressed store, hash-verified

254 * Maps rate limit errors
255 */
256 protected mapRateLimitError(message: string, response: unknown): RateLimitExceeded {
257 // Try to extract retry-after from headers
258 const headers = (
259 typeof response === 'object' && response !== null && 'headers' in response
260 ? (response as { headers?: Record<string, string> }).headers
261 : undefined
262 );
263 const retryAfter = headers?.['retry-after'];
264 const retryAfterSeconds = retryAfter ? parseInt(retryAfter, 10) : undefined;
265
266 return new RateLimitExceeded(message, retryAfterSeconds, this.exchangeName);
267 }
268
269 /**
270 * Extracts error message from various error formats

Callers 1

mapByStatusCodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected