Skip to content

Commit

Permalink
fix(errors): pass message through to APIConnectionError (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Sep 13, 2024
1 parent 14efa88 commit 75b7a3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class APIError extends MetronomeError {
headers: Headers | undefined,
) {
if (!status) {
return new APIConnectionError({ cause: castToError(errorResponse) });
return new APIConnectionError({ message, cause: castToError(errorResponse) });
}

const error = errorResponse as Record<string, any>;
Expand Down Expand Up @@ -101,7 +101,7 @@ export class APIUserAbortError extends APIError {
export class APIConnectionError extends APIError {
override readonly status: undefined = undefined;

constructor({ message, cause }: { message?: string; cause?: Error | undefined }) {
constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
super(undefined, undefined, message || 'Connection error.', undefined);
// in some environments the 'cause' property is already declared
// @ts-ignore
Expand Down

0 comments on commit 75b7a3a

Please sign in to comment.