Closed nganju98 closed 4 months ago
@nganju98 I've cleaned this up some in my working branch. Now the json parseable message will come through directly in non Auth/500 instances. In Net 6+ you'll also get the statuscode in the request exception, in netstandard 2.0 it's not an option, I had to carve it out.
In EndPointBase.cs lines 150-175 the original exceptions are being swallowed somewhat. The http status code of your rethrown exception is null, can you make it the same as the original? Also the original content coming from Anthropic is json parseable. But you write some plaintext in front of the json so it's not parseable any more. Here's an example I got (please set HttpStatusCode to 529!) and your exception handling code below that.
HttpRequestException: Error at https://api.anthropic.com/v1/messages (https://api.anthropic.com/v1/messages) with HTTP status code: 529. Content: {"type":"error","error":{"type":"overloaded_error","message":"Overloaded"}}
Code: