From 75b7a3ad8eb11646de21487fa61d5c0c3c62badb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:30:55 +0000 Subject: [PATCH] fix(errors): pass message through to APIConnectionError (#94) --- src/error.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error.ts b/src/error.ts index 1f6c2bb..6a49e92 100644 --- a/src/error.ts +++ b/src/error.ts @@ -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; @@ -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