Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Include more error context in deduction failures #561

Merged
merged 1 commit into from
May 23, 2017

Conversation

spenczar
Copy link
Contributor

@spenczar 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.

@sdboyer
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
Copy link
Contributor Author

@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
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
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
@spenczar spenczar deleted the wrap_deduce_errs branch May 23, 2017 15:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants