Comments (3)
@leandrodvd I created a TROUBLESHOOT.md guideline to help explain how to handle errors. Hope it helps
from azure-sdk-for-java.
@mssfang could you please follow up with @leandrodvd? Is this something that should be covered in the README or TROUBLESHOOT guide
from azure-sdk-for-java.
Hi, yeah, the documentation looks like a good start, but it's kinda shallow, only shows what exception to catch, could have more details on the exception content. For instance I learned that the HttpResponseException.getValue()
contains an Error object with an error code that tells me what is the actual error. That error code is fundamental to understanding what is the actual error. This kind of detail could be documented.
A better solution (and maybe a separate issue) would be to have the error mapped to some model class that I can use. That's in fact the solution I implemented, I created an "Error"
record and on HttpResponseException
catch I deserialize the .getValue()
content to that class so that I can access the error details (for instance I'm interested in error code so that I can treat content_filter
and context_length_exceeded
errors so that I can format a nice answer to my user)
I implemented this Error class on my side but I believe this should be part of the SDK
public record HttpResponseExceptionError(
Error error
) {
}
public record Error(
String message,
String type,
String param,
String code
) {
}
try {
chatCompletions = openAiClient.getChatCompletions(...);
} catch (HttpResponseException e) {
HttpResponseExceptionError httpResponseExceptionError = BinaryData.fromObject(e.getValue()).toObject(HttpResponseExceptionError.class);
log.info("HttpResponseException occurred - error code {}", httpResponseExceptionError.error().code());
from azure-sdk-for-java.
Related Issues (20)
- [BUG] Azure Communication Service Job Router RouterValue class Deserialize Issue HOT 1
- Factory method 'openAIClient' threw exception; nested exception is java.lang.NoClassDefFoundError: reactor/util/Loggers HOT 3
- Detected an instance of Random/SplittableRandom class in the image heap HOT 2
- [BUG] Cosmos hangs forever with CosmosEndToEndOperationLatencyPolicyConfig set HOT 2
- [OpenAI] Support token calculation in streaming API
- Use an access token directly instead of token credential HOT 1
- [BUG] Azure Communication Service Job Router Java SDK having Deserialize Issue for RouterValue class HOT 3
- Receive message connection from ServiceBusProcessorClient closes due to inactivity in service bus HOT 3
- [Question] Implementing Long-Running Operations with SyncPoller HOT 3
- Change BinaryData fromObject(Object) and toObject(Class<T>) / toObject(TypeReference<T>) behavior
- OpenRewrite recipes for moving usages from azure-core to io.clientcore
- Authentication window not opening in browser[BUG] HOT 2
- [BUG]azure-cosmos-spark is not able to read array type field as string HOT 4
- [FEATURE REQ] Support auth by customer defined TokenCredencial for all scenarios HOT 1
- [BUG] [Azure OpenAI] block()/blockFirst()/blockLast() are blocking, which is not supported in thread reactor-http-nio-2 HOT 4
- ChatCompletion call with image as data url not working with com.azure:azure-ai-openai:1.0.0-beta.9 HOT 5
- Callautomation implementation design feedbacks HOT 1
- Storage - Queues Samples Issue
- Azure Redis Checkpoint Store Samples Issue
- [BUG] The response `The requested URI does not represent any resource on the server.` is not helpful when the blob name is `null` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sdk-for-java.