From 9487c117e05d1a406820a3b0c07415878f5d570d Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 13 Nov 2024 12:39:35 +1030 Subject: [PATCH] chore(sdk-react): Propgate error message (#96) --- sdk-react/src/hooks/useRun.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk-react/src/hooks/useRun.ts b/sdk-react/src/hooks/useRun.ts index c4439d2c..4a90ffe4 100644 --- a/sdk-react/src/hooks/useRun.ts +++ b/sdk-react/src/hooks/useRun.ts @@ -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); } @@ -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) { @@ -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)}`)); } };