mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-09-20 06:31:57 +00:00
Record timestamp when a context was cancelled (#1018)
This commit is contained in:
parent
0aa8e1cd98
commit
45b02f46d9
1 changed files with 4 additions and 1 deletions
|
@ -166,6 +166,9 @@ func captureCancelCallstack(ctx logCtx, f context.CancelFunc) (Context, context.
|
|||
}
|
||||
f()
|
||||
// Set the error with the stacktrace if the err pointer is non-nil.
|
||||
*ctx.err = fmt.Errorf("%w (%s)", ctx.Err(), string(debug.Stack()))
|
||||
*ctx.err = fmt.Errorf(
|
||||
"%w (canceled at %v\n%s)",
|
||||
ctx.Err(), time.Now(), string(debug.Stack()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue