fix(task-sdk): include error details in ServerResponseError string representation#63368
Open
YoannAbriel wants to merge 1 commit intoapache:mainfrom
Open
fix(task-sdk): include error details in ServerResponseError string representation#63368YoannAbriel wants to merge 1 commit intoapache:mainfrom
YoannAbriel wants to merge 1 commit intoapache:mainfrom
Conversation
…presentation When ServerResponseError propagated up the stack without being explicitly caught and handled, the error details were lost because __str__() only returned the base message without the detail attribute. This made debugging difficult as logs would show 'Server returned error' without any context about what actually went wrong. Added __str__() override to include the detail when present, so error details are always visible in logs and tracebacks regardless of how the exception is caught and re-raised. Closes: apache#57961
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
ServerResponseErroris raised and propagates up the call stack without being explicitly caught and handled, error details are lost. Logs show only:...without any information about what actually went wrong. This makes debugging significantly harder, especially for
TaskInstanceOperationscalls where the exception is not caught and re-logged withe.detail.Root Cause
ServerResponseErrorstores error details in itsdetailattribute, but the__str__()method (inherited fromhttpx.HTTPStatusError) only returns the base message. When the exception is logged via traceback orstr(err), the detail is silently dropped.Some call sites (e.g.,
VariableOperations) explicitly catchServerResponseErrorand loge.detail, but many others (e.g.,TaskInstanceOperations.start()) let it propagate, losing the detail entirely.Fix
Added a
__str__()override toServerResponseErrorthat appends thedetailattribute when present. This ensures error details are always visible in logs and tracebacks, regardless of how the exception is caught.Before:
After:
Verified with unit tests. No external service access needed.
Closes: #57961
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4, claude-opus-4-6) following the guidelines