Skip to content

fix: standardize error handling and improve resilience across SDK - #246

Open
luk384090-cloud wants to merge 13 commits into
mainfrom
dev/errors
Open

fix: standardize error handling and improve resilience across SDK#246
luk384090-cloud wants to merge 13 commits into
mainfrom
dev/errors

Conversation

@luk384090-cloud

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves error handling, parsing, and resilience across various API clients and protocols, including adding transient error retries with backoff in AsynchronousApi, extracting structured error codes and messages from JSON/non-JSON responses, and standardizing error types using the ErrorType enum. The review feedback highlights a potential NullPointerException in DashScopeResult due to auto-unboxing of a nullable Integer status code, suggests preserving a fallback error message in AgentStudioEventStream when the response body is empty, and recommends properly handling InterruptedException in AsynchronousApi instead of swallowing it.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/main/java/com/alibaba/dashscope/common/DashScopeResult.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/common/DashScopeResult.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/common/DashScopeResult.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/api/AsynchronousApi.java
Comment thread src/main/java/com/alibaba/dashscope/api/AsynchronousApi.java
Comment thread src/main/java/com/alibaba/dashscope/api/AsynchronousApi.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/api/AsynchronousApi.java
Comment thread src/main/java/com/alibaba/dashscope/api/AsynchronousApi.java
Comment thread src/main/java/com/alibaba/dashscope/audio/http_tts/HttpSpeechSynthesizer.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/protocol/okhttp/OkHttpHttpClient.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/protocol/okhttp/OkHttpWebSocketClient.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/utils/OSSUtils.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/utils/OSSUtils.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/audio/http_tts/HttpSpeechSynthesizer.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/common/DashScopeResult.java Outdated
Comment thread src/main/java/com/alibaba/dashscope/protocol/okhttp/OkHttpHttpClient.java Outdated
kevin and others added 6 commits July 23, 2026 14:41
Add AgentStudioException that converges error codes onto PublicErrorDef
(the single source of truth shared with the Python SDK). getCode()
returns the unified Anthropic-compatible code (rewriting legacy aliases
like permission_denied_error, mapping PascalCase server codes via
PublicErrorDef.fromErrorCode, and falling back to the per-status row
when the server omits one); the raw server code stays on getRawCode().
Default messages come from the registry with {var} placeholders stripped.
AsyncHelper wraps ApiException as AgentStudioException at the source so
all consumers see the unified type; joinAndUnwrap just unwraps the
CompletionException shell.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fix CI linter (google-java-format-1.7) failures on the previous commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants