Skip to content

commands: include error in LoggedError()#2179

Merged
ttaylorr merged 6 commits intomasterfrom
log-more-info
Apr 26, 2017
Merged

commands: include error in LoggedError()#2179
ttaylorr merged 6 commits intomasterfrom
log-more-info

Conversation

@ttaylorr
Copy link
Contributor

@ttaylorr ttaylorr commented Apr 26, 2017

This pull request resolves the first concern raised in #2076:

(1) Requiring the user to check the logfile before seeing the full text of an error seems like an unnecessary extra step that prevents quick troubleshooting. This slight obfuscation of underlying cause of errors also likely leads to vague issue reports, which is harder on the maintainers.

I was looking into the cause of this and found that the callsites in question were using the function commands.LoggedError(), which has the signature:

func LoggedError(err error, format string, args ...interface{}) { /* ... */ }

What this does is effectively:

  1. fmt.Fprintf(os.Stderr, format, args...), (write the format string to stderr) and
  2. LogError(os.File, err) (log the error to git lfs logs last)

Notably, this function does not print the error to stderr unless specified with the format string and arguments. Something like this would look like:

LoggedError(err, "%s", err)

I think this is good behavior, since different functions will want to format errors differently. That being said, I looked at all of the callers of LoggedError and updated them to include the error that they are logging using the %s format, which is cause: error without a stacktrace. This should better surface errors that were previously only accessible via a git lfs logs last, and will resolve #2076.

Closes #2076.


/cc @git-lfs/core @JarrettR #2076

@ttaylorr ttaylorr added this to the v2.1.0 milestone Apr 26, 2017
@ttaylorr ttaylorr requested a review from technoweenie April 26, 2017 15:53
Copy link
Contributor

@technoweenie technoweenie left a comment

Choose a reason for hiding this comment

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

I think this is a good approach, consistent with the change to use %+v in the error log files in #2178.

@ttaylorr ttaylorr merged commit edb2220 into master Apr 26, 2017
@ttaylorr ttaylorr deleted the log-more-info branch April 26, 2017 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error reporting

2 participants