log stacktrace on error fixes issue #84#97
Open
scottillogical wants to merge 2 commits intogocraft:masterfrom
Open
log stacktrace on error fixes issue #84#97scottillogical wants to merge 2 commits intogocraft:masterfrom
scottillogical wants to merge 2 commits intogocraft:masterfrom
Conversation
Author
|
This still looks good and is very simple, can a maintainer look at it? |
shdunning
requested changes
Jul 23, 2018
|
|
||
| func logError(key string, err error) { | ||
| fmt.Printf("ERROR: %s - %s\n", key, err.Error()) | ||
| debug.PrintStack() |
Collaborator
There was a problem hiding this comment.
I don't think this is doing what you think it is. Isn't this just printing the stacktrace at the time of the call and will always print the same exact stack trace regardless of the error?
The canonical "Go way" of dealing with errors and stacktraces is: https://godoc.org/github.com/pkg/errors
Refactoring gocraft/work to use pkg/errors is a little more of an undertaking, but likely worth the effort.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
right now, if a worker panics gotcraft work will just log (which is what i ran into) the error but not a stacktrace
ERROR: runJob.panic - runtime error: invalid memory address or nil pointer dereferencenow it will also log a stacktrace as mentioned was desirable #84