Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion private/app/launcher/launcher_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package launcher

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -46,7 +47,7 @@ type Application struct {
// Run will exit the application if it encounters a fatal error.
func (a *Application) Run() {
if err := a.run(); err != nil {
fmt.Fprintf(a.getErrorWriter(), "fatal error: %v\n", err)
fmt.Fprintf(a.getErrorWriter(), "fatal error: %v\n %#v\n", err, errors.Unwrap(err))
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, this still produces hard to read error messages.

Instead, I think you should use errors.As together with toml.StrictMissingError and toml.DecodeError

If error matches -> pretty print to stderr

I would also leave this line unchanged.

os.Exit(1)
}
}
Expand Down
3 changes: 2 additions & 1 deletion private/app/launcher/launcher_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package launcher

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -73,7 +74,7 @@ type Application struct {
// Run will exit the application if it encounters a fatal error.
func (a *Application) Run() {
if ec, err := a.run(); err != nil {
fmt.Fprintf(a.getErrorWriter(), "fatal error: %v\n", err)
fmt.Fprintf(a.getErrorWriter(), "fatal error: %v\n %#v\n", err, errors.Unwrap(err))
os.Exit(ec)
}
}
Expand Down
Loading