Skip to content

Conversation

@jitokim
Copy link
Contributor

@jitokim jitokim commented Nov 9, 2024

Fix error handler with using unsubscribed response body in exception message in AnthropicApi class.

When an error occurs while calling the chatCompletionStream function, It's difficult to know the cause.

AS-IS
RuntimeException's message is a toString of an object (Mono<String>).

Response exception, Status: [401 UNAUTHORIZED], Body:[checkpoint("Body from POST https://api.anthropic.com/v1/messages [DefaultClientResponse]")]

image

TO-BE
Replace the RuntimeException's message with the response body.

Response exception, Status: [401 UNAUTHORIZED], Body:[{"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}]

image

@jitokim jitokim force-pushed the improve-error-handle-anthropicapi-webclient branch from 44fb466 to 34926aa Compare November 9, 2024 18:06
@jitokim jitokim changed the title Fix issue with using unsubscribed response body in exception message Fix error handler with using unsubscribed response body in exception message Nov 9, 2024
@jitokim jitokim force-pushed the improve-error-handle-anthropicapi-webclient branch from 34926aa to 7e71a3e Compare November 12, 2024 01:25
@markpollack markpollack added this to the 1.0.0-M4 milestone Nov 12, 2024
@markpollack markpollack assigned tzolov and markpollack and unassigned tzolov Nov 12, 2024
@markpollack
Copy link
Member

Thanks! merged in fb2e752

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants