-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[backend/filestate] Don't unwrap go-cloud errors #8455
Conversation
@@ -323,7 +323,7 @@ func (b *localBackend) GetStack(ctx context.Context, stackRef backend.StackRefer | |||
snapshot, path, err := b.getStack(stackName) | |||
|
|||
switch { | |||
case gcerrors.Code(drillError(err)) == gcerrors.NotFound: | |||
case gcerrors.Code(err) == gcerrors.NotFound: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem seems to be that we are passing the unwrapped error to go-cloud's Code
func which tries to find a matching error that it can assign as gcerr.Error
. So when it is passed an already-unwrapped error, it fails return the error code that we expect to compare against.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, gcerrors
itself is wrapping errors, so when we unwrap the chain, it prevents gcerrors.Code
from finding its wrapped error. This is my bad, I had suggested unwrapping the full chain to @iwahbe since we are also wrapping, not realizing that gcerrors
itself is wrapping and relying on it. Sorry about that @iwahbe.
I didn't update the changelog, but I think this PR does warrant an entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test without fix correctly show failure and this fixes the problem on my machine. I'm happy here.
Description
Pulumi CLI fails with the following error when running
pulumi stack select dev2 -c
to select a stack but first creating it, if it does not exist already.Fixes #8461 (Related to #8406)
Checklist