Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added error message and cause #155

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/baseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ export abstract class ApiClient {
// Parse the response and check for errors.
if (response instanceof Error) {
if (response.name === 'AbortError') {
throw new APIConnectionTimeoutError();
throw new APIConnectionTimeoutError({
message: `${response.message} \n STACK: ${response.stack}`,
});
}
throw new APIConnectionError({ cause: response });
}
Expand Down
6 changes: 5 additions & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export class APIConnectionError extends APIError {
const LOCALHOST_CONNECTION_ERROR = `Could not instantiate the Portkey client.
You can either add a valid 'apiKey' parameter (from https://app.portkey.ai/api-keys)
or check the 'baseURL' parameter in the Portkey client,
for your AI Gateway's instance's URL.`;
for your AI Gateway's instance's URL. \

CAUSE: ${cause} \

MESSAGE: ${message}`;
super(
undefined,
undefined,
Expand Down
Loading