Skip to content

Commit

Permalink
add missing error classes to types
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbeatty committed Jun 7, 2024
1 parent 250c863 commit 64c7dd1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/handler/retry-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class RetryHandler {
this.abort(
new RequestRetryError('Content-Range mismatch', statusCode, {
headers,
count: this.retryCount
data: { count: this.retryCount }
})
)
return false
Expand All @@ -213,7 +213,7 @@ class RetryHandler {
this.abort(
new RequestRetryError('ETag mismatch', statusCode, {
headers,
count: this.retryCount
data: { count: this.retryCount }
})
)
return false
Expand Down
21 changes: 21 additions & 0 deletions types/errors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,25 @@ declare namespace Errors {
name: 'ResponseExceededMaxSizeError';
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
}

export class RequestRetryError extends UndiciError {
constructor (
message: string,
statusCode: number,
headers?: IncomingHttpHeaders | string[] | null,
body?: null | Record<string, any> | string
);
name: 'RequestRetryError';
code: 'UND_ERR_REQ_RETRY';
statusCode: number;
data: {
count: number;
};
headers: Record<string, string | string[]>;
}

export class SecureProxyConnectionError extends UndiciError {
name: 'SecureProxyConnectionError';
code: 'UND_ERR_PRX_TLS';
}
}

0 comments on commit 64c7dd1

Please sign in to comment.