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

Include more error context in deduction failures #561

Merged
merged 1 commit into from May 23, 2017

Conversation

Projects
None yet
3 participants
@spenczar
Copy link
Contributor

spenczar commented May 11, 2017

More liberal use of errors.Wrap gives more complete output, like this:

% dep init
Unable to cache code.justin.tv/release/trace
sm.DeduceProjectRoot: unable to deduce repository and source type for "code.justin.tv/release/trace": unable to read metadata: unable to fetch raw metadata: failed HTTP request to URL "http://code.justin.tv/release/trace?go-get=1": Get http://code.justin.tv/release/trace?go-get=1: dial tcp: lookup code.justin.tv: no such host

This could be improved, readability-wise, but the first step is to preserve the error information up to the caller.

Fixes #556.

@googlebot googlebot added the cla: yes label May 11, 2017

@sdboyer

This comment has been minimized.

Copy link
Member

sdboyer commented May 16, 2017

So, I'm unsure about this. We don't want to double-wrap these errors, and while it's more convenient to wrap them in the central location that sourceGateway provides, my understanding is that it's more useful/better practice to wrap them immediately where they're generated, at the boundaries our code - no?

@spenczar

This comment has been minimized.

Copy link
Contributor

spenczar commented May 16, 2017

@sdboyer I haven't heard that advice. I just use errors.Wrap to build the stack of errors so it can be printed back in a way that makes the error clear... Are you saying you'd prefer this error?

% dep init
Unable to cache code.justin.tv/release/trace
Get http://code.justin.tv/release/trace?go-get=1: dial tcp: lookup code.justin.tv: no such host
@sdboyer

This comment has been minimized.

Copy link
Member

sdboyer commented May 16, 2017

@spenczar i'm honestly not sure about it myself - @davecheney, did i read this somewhere, or am I pulling this out of my ass - is it suboptimal to errors.Wrap() multiple times?

I think just the dial error may be a bit lower-level than we're looking for, but...well, honestly, I mostly just want us to be consistent.

@sdboyer

This comment has been minimized.

Copy link
Member

sdboyer commented May 23, 2017

I'm gonna call this fine as incremental progress, and click the big green button 😄

@sdboyer sdboyer merged commit 4088a1b into golang:master May 23, 2017

4 checks passed

cla/google All necessary CLAs are signed
codeclimate no new or fixed issues
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@spenczar spenczar deleted the spenczar:wrap_deduce_errs branch May 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment