From 933f565bcc6187e2a639e51fafe96e41967c6823 Mon Sep 17 00:00:00 2001 From: Ian McLerran Date: Fri, 3 Jan 2025 13:41:24 -0600 Subject: [PATCH] Add http error message to updateMessagesList --- package/Chat.roc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/Chat.roc b/package/Chat.roc index a4b2dbc..4a2f9be 100644 --- a/package/Chat.roc +++ b/package/Chat.roc @@ -256,8 +256,12 @@ updateMessageList = \responseRes, messages-> Err NoChoices -> appendSystemMessage messages "No choices in API response" {} Err (BadJson str) -> appendSystemMessage messages "Could not decode JSON response:\n$(str)" {} Err DecodingError -> appendSystemMessage messages "Error decoding API response" {} + + Err (HttpErr (BadStatus { code }) ) -> + appendSystemMessage messages "Http error: $(Num.toStr code)" {} - Err (HttpErr _) -> messages + Err (HttpErr _) -> + appendSystemMessage messages "Http error" {} ## Encode the request body to be sent in the Http request. encodeRequestBody : ChatRequestBody -> List U8