Repository navigation
feat(gax): add resolveExceptionStacktrace helper for exception.stacktrace - #9744
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the resolveExceptionStacktrace utility function to extract stack traces for failed calls, handling server-side and client-side errors differently, along with comprehensive unit tests. Feedback suggests adding defensive checks to ensure the error argument is a non-null object, preventing potential runtime crashes if a non-object is passed to the utility.
6f683da to
3dcc5dd
Compare
3dcc5dd to
4011d85
Compare
1dd4794 to
3e15f55
Compare
quirogas
left a comment
There was a problem hiding this comment.
Reviewed #9744 against the Milestone 2 Error Logging design doc, the cross-language error logging specification, and live gRPC/REST (fallback: 'rest') error payloads. Left 1 blocking comment on resolveExceptionStacktrace (and its corresponding test case in test/unit/errorUtil.ts).
quirogas
left a comment
There was a problem hiding this comment.
Approving to unblock merging once the inline comments above are addressed.
8a006fa to
18696e0
Compare
87d17ca to
dfd3ac8
Compare
dfd3ac8 to
15c8692
Compare
…race Add resolveExceptionStacktrace to errorUtil so LoggerHelper can populate exception.stacktrace. Server-side errors use the status details and response metadata formatted by resolveServerExceptionDetails, and have no stacktrace when the server sent neither. All other errors use the JavaScript stack (e.stack).
resolveExceptionStacktrace now takes unknown, matching resolveExceptionMessage. Server-side Error instances still use the server-provided details; all other values use their stack when it is a string, so thrown strings, null, and plain objects have no stacktrace.
Check only the routing to resolveServerExceptionDetails instead of repeating its formatting test, cover the empty-stack check, and drop a non-Error case that took the same path as the string case.
…erse cause chain in resolveServerExceptionDetails
…e backoffSettings on merge
15c8692 to
87abd2a
Compare
This PR adds a
resolveExceptionStacktracehelper soLoggerHelpercan populate theexception.stacktracelog attribute from the JavaScript call stack, simplifiesresolveServerExceptionDetails, and fixestimeout: 0and sharedbackoffSettingshandling during retrying calls.Key Changes
resolveExceptionStacktrace(e: unknown)inerrorUtil.tsto resolveexception.stacktracefrom the first non-empty stringstackon the errorresolveServerExceptionDetailsto resolve only{message}while traversing the full.causechain (up toDEPTH_TO_CHECKwith cycle detection), removing syntheticstatusDetails/metadatastacktrace formatting and eager gRPC status details decoding (raw payloads belong in L4response.payload, notexception.stacktrace).retrycopy-on-write viacloneRetryOptionsinCallSettings.mergewhen per-calltimeoutormaxRetriesoverrides modifybackoffSettings, preventing mutation of shared method defaults or caller-ownedbackoffSettingswhile keeping the 30s default fallback onCallSettings.timeoutfor0/undefined.retryableinretries.tsto treattotalTimeoutMillis: 0as an explicit deadline instead of ignoring it (Infinity), allowing attempt 1 to run once with a 0ms deadline (recording its attempt span) before stopping cleanly without spinning in a retry loop.errorUtil.ts,gax.ts, andapiCallable.tscoveringresolveExceptionStacktrace, deep/circular.causechains,CallSettings.mergecopy-on-write isolation, andtimeout: 0retry behavior.