MCPcopy Create free account
hub / github.com/PSPDFKit/nutrient-document-engine-mcp-server / shouldRetryError

Function shouldRetryError

src/api/Client.ts:160–178  ·  view source on GitHub ↗

* Determines if an error should be retried

(error: unknown, status?: number)

Source from the content-addressed store, hash-verified

158 * Determines if an error should be retried
159 */
160function shouldRetryError(error: unknown, status?: number): boolean {
161 // Retry on network errors (no status)
162 if (!status) {
163 return true;
164 }
165
166 // Retry on 5xx server errors
167 if (status >= 500) {
168 return true;
169 }
170
171 // Retry on specific 4xx errors that might be transient
172 if (status === 408 || status === 429) {
173 // Request Timeout, Too Many Requests
174 return true;
175 }
176
177 return false;
178}
179
180/**
181 * Calculates exponential backoff delay with jitter

Callers 1

attemptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected