Skip to content

Commit

Permalink
feat(errors): add request_id property (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Apr 15, 2024
1 parent 56f4821 commit 43aa6a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class APIError extends OpenAIError {
readonly param: string | null | undefined;
readonly type: string | undefined;

readonly request_id: string | null | undefined;

constructor(
status: number | undefined,
error: Object | undefined,
Expand All @@ -22,6 +24,7 @@ export class APIError extends OpenAIError {
super(`${APIError.makeMessage(status, error, message)}`);
this.status = status;
this.headers = headers;
this.request_id = headers?.['x-request-id'];

const data = error as Record<string, any>;
this.error = data;
Expand Down

0 comments on commit 43aa6a1

Please sign in to comment.