Skip to content

Commit

Permalink
Add http error message to updateMessagesList
Browse files Browse the repository at this point in the history
  • Loading branch information
imclerran committed Jan 3, 2025
1 parent 15ac5ba commit 933f565
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package/Chat.roc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 933f565

Please sign in to comment.