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]")]
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"}}]
Comment From: markpollack
Thanks! merged in fb2e7528d0b74ae4adcb4aa6e18436bff2e808e5