From 9ca6769fc35bb089e30ce85a20d221c1d9c720c3 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Sat, 14 Sep 2024 17:00:42 +0000 Subject: [PATCH] fix(errors): pass message through to APIConnectionError --- src/error.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error.ts b/src/error.ts index 1ab40d7..fc81972 100644 --- a/src/error.ts +++ b/src/error.ts @@ -49,7 +49,7 @@ export class APIError extends PromptFoundryError { 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