Skip to content

Commit

Permalink
chore(sdk-react): Propgate error message (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith authored Nov 13, 2024
1 parent dbab3f4 commit 9487c11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdk-react/src/hooks/useRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function useRun(options: UseExistingRunOptions | UseNewRunOptions): UseRu
});

if (response.status !== 201) {
options.onError?.(new Error(`Could not create run. Status: ${response.status}`));
options.onError?.(new Error(`Could not create run. Status: ${response.status} Body: ${JSON.stringify(response.body)}`));
} else {
setRunId(response.body.id);
}
Expand Down Expand Up @@ -116,7 +116,7 @@ export function useRun(options: UseExistingRunOptions | UseNewRunOptions): UseRu
if (messageResponse.status === 200) {
setMessages(messageResponse.body);
} else {
options.onError?.(new Error(`Could not list messages. Status: ${messageResponse.status}`));
options.onError?.(new Error(`Could not list messages. Status: ${messageResponse.status} Body: ${JSON.stringify(messageResponse.body)}`));
}

if (runResponse.status === 200) {
Expand All @@ -142,7 +142,7 @@ export function useRun(options: UseExistingRunOptions | UseNewRunOptions): UseRu
});

if (response.status !== 201) {
options.onError?.(new Error(`Could not create message. Status: ${response.status}`));
options.onError?.(new Error(`Could not create message. Status: ${response.status} Body: ${JSON.stringify(response.body)}`));
}
};

Expand Down

0 comments on commit 9487c11

Please sign in to comment.