Skip to content
This repository has been archived by the owner on Dec 23, 2022. It is now read-only.

scheme.go: Wrap all errors with context #13

Merged
merged 4 commits into from
Oct 24, 2019

Conversation

brancz
Copy link
Contributor

@brancz brancz commented Oct 24, 2019

Copy link
Contributor

@metalmatze metalmatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there are some strings where we use %v when we could use %s, I think. But that shouldn't matter that much.

@brancz brancz merged commit 8524316 into observatorium:master Oct 24, 2019
@brancz brancz deleted the wrap-errors branch October 24, 2019 16:16
}

defer r.Close()

err = rs.toBkt.Upload(ctx, objectName, r)
if err != nil {
return err
return fmt.Errorf("upload %v to target bucket: %w", objectName, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all should be errors.Errorf I think 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be totally misunderstanding but this doesn’t sound like that to me https://blog.golang.org/go1.13-errors

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wooow, this is more complex then I expected. Looks like "github.com/pkg/errors" and errors are literally incompatible now. Also just learn that if you use "github.com/pkg/errors.Wrap"`` and then on top caller you log this and if you use %s it's different then if you use `%v`... for %v it is stack trace even 0.o

So yea, you are right I guess - let's choose one and use it consistently...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this should fix the compatibility: pkg/errors#206

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants