Conversation
…th stack frame skipping Co-authored-by: Genie <[email protected]>
Co-authored-by: Genie <[email protected]>
Co-authored-by: Genie <[email protected]>
PandelisZ
commented
Jul 29, 2025
| If cause is nil, PropagateSkip returns nil. | ||
| */ | ||
| func PropagateSkip(cause error, skip int, msg string, vals ...interface{}) error { | ||
| if cause == nil { |
Author
There was a problem hiding this comment.
Can we have some further logging of causes and effect
Co-authored-by: Genie <[email protected]>
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.
This pull request introduces new functions to the
stacktracepackage:PropagateSkip,NewErrorSkip, and their variants. These functions allow users to skip an arbitrary number of frames in the stack trace, thereby enabling better stack trace reporting in helper functions. This solves the issue where the original invocation point of a helper function was replaced by the helper itself in the stack trace.New Functions Introduced:
NewErrorSkip(skip int, msg string, vals ...interface{}) error: Creates a new error with the ability to skip specified stack frames.PropagateSkip(cause error, skip int, msg string, vals ...interface{}) error: Propagates an error while allowing skip of frames.NewErrorWithCodeSkip(code ErrorCode, skip int, msg string, vals ...interface{}) error: Similar toNewErrorWithCode, but allows skipping frames.ErrorBuilder: Enhanced class to construct errors with custom skip values.Testing: New tests in
skip_test.goconfirm that the correct caller information is maintained and that the helper function itself does not appear in the error string when usingPropagateSkipand the builder methods.These changes enhance usability for error handling within our libraries.
Original Task: stacktrace/866fqf1v1hka
Author: Pandelis Zembashis