Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Updated error logging. #1806

Merged
merged 1 commit into from
Mar 27, 2018
Merged

Updated error logging. #1806

merged 1 commit into from
Mar 27, 2018

Conversation

russjones
Copy link
Contributor

@russjones russjones commented Mar 22, 2018

Purpose

Cleanup error logging.

Implementation

When utils.FatalError is called, check if a user message has been embedded in the error. If it does, prefix the user message to the wrapped error. If not, it prefixes a generic user message: "A fatal error occurred".

Here are a few examples of what these errors will look like:

$ teleport start
Initialization failed: mkdir /var/lib/teleport: permission denied
$ teleport start
A fatal error occurred: mkdir /var/lib/teleport: permission denied
$ teleport start -d

ERROR REPORT:
Original Error: *os.PathError mkdir /var/lib/teleport: permission denied
Stack Trace:
	/home/rjones/Development/go/src/github.com/gravitational/teleport/lib/service/service.go:335 github.com/gravitational/teleport/lib/service.NewTeleport
	/home/rjones/Development/go/src/github.com/gravitational/teleport/tool/teleport/common/teleport.go:168 github.com/gravitational/teleport/tool/teleport/common.OnStart
	/home/rjones/Development/go/src/github.com/gravitational/teleport/tool/teleport/common/teleport.go:148 github.com/gravitational/teleport/tool/teleport/common.Run
	/home/rjones/Development/go/src/github.com/gravitational/teleport/tool/teleport/main.go:29 main.main
	/usr/local/go/src/runtime/proc.go:204 runtime.main
	/usr/local/go/src/runtime/asm_amd64.s:2338 runtime.goexit
User Message: Initialization failed

Related Issues

Fixes #1798

@russjones russjones force-pushed the rjones/dont-suppress-errors branch from 46e50c1 to f3950d1 Compare March 23, 2018 01:02
Copy link
Contributor

@kontsevoy kontsevoy left a comment

Choose a reason for hiding this comment

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

I couldn't test this because it does not build. I am getting this error:

luna ~/go/src/github.com/gravitational/teleport: make full
VERSION=2.6.0-alpha.0 make -f version.mk setver
make[1]: Entering directory '/home/ekontsevoy/go/src/github.com/gravitational/teleport'
make[1]: Leaving directory '/home/ekontsevoy/go/src/github.com/gravitational/teleport'
Building Teleport with PAM support.
make -s -j 3 build/teleport build/tctl build/tsh
# github.com/gravitational/teleport/vendor/github.com/coreos/etcd/client
vendor/github.com/coreos/etcd/client/keys.go:30:2: can't find import: "github.com/gravitational/teleport/vendor/github.com/ugorji/go/codec"
Makefile:61: recipe for target 'build/teleport' failed
make[1]: *** [build/teleport] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:54: recipe for target 'all' failed
make: *** [all] Error 2

Also this looks too complex. If printing a correct error message requires type assertions it means we're returning broken errors. How come we don't do this in other places and it works?

@kontsevoy
Copy link
Contributor

[udpate] rjones and I have resolved issues on my machine in-person.

@russjones russjones force-pushed the rjones/dont-suppress-errors branch from f3950d1 to ff436e2 Compare March 27, 2018 00:56
@russjones russjones merged commit 260a0e7 into master Mar 27, 2018
@russjones russjones deleted the rjones/dont-suppress-errors branch March 27, 2018 01:00
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing experience for 1st timers
3 participants