Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stack support #8

Merged
merged 3 commits into from
Jun 21, 2024
Merged

Add stack support #8

merged 3 commits into from
Jun 21, 2024

Conversation

dmcgowan
Copy link
Member

Adds a new stack package which provides a stack error type. This is based off the stack from the archived pkg/errors package and buildkit's util/stack.

Differences...

  • Directly serializable and registered with typeurl. Does not rely on protobuf generation or registration. The additional control over the marshal/unmarshal allows an efficient and single error object to be used.
  • Does not wrap errors, instead relies on latest support in Go for multi-errors with the Unwrap() []error interface. This allows stacks to ride next to errors without changing their error structure. Introduced a "collapsible" interface to avoid outputting the stack errors unless the %+v option is given.
  • Simple helper interface using contexts with no global map
  • Uses runtime.CallerFrames to account for inlined functions instead of the "discourage" runtime.FuncForPC. See https://pkg.go.dev/runtime#Callers

Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
@estesp estesp merged commit 6fb6cf0 into containerd:main Jun 21, 2024
7 checks passed
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