Some commands fail with stack traces, they should fail with a friendlier message and use a logger.
For example it happens with export commands like metricbeat export dashboard -id not-exist, that fails with messages like:
2020-04-16T20:22:57.202+0200 INFO kibana/client.go:118 Kibana url: http://localhost:5601
Error exporting dashboard: error exporting dashboard: Saved object [dashboard/not-exist] not found
github.com/elastic/beats/v7/libbeat/kibana.extractError
/home/jaime/gocode/src/github.com/elastic/beats/libbeat/kibana/client.go:74
github.com/elastic/beats/v7/libbeat/kibana.(*Connection).Request
/home/jaime/gocode/src/github.com/elastic/beats/libbeat/kibana/client.go:177
github.com/elastic/beats/v7/libbeat/kibana.(*Client).GetDashboard
/home/jaime/gocode/src/github.com/elastic/beats/libbeat/kibana/client.go:294
github.com/elastic/beats/v7/libbeat/dashboards.Export
/home/jaime/gocode/src/github.com/elastic/beats/libbeat/dashboards/export.go:54
github.com/elastic/beats/v7/libbeat/cmd/export.GenDashboardCmd.func1
/home/jaime/gocode/src/github.com/elastic/beats/libbeat/cmd/export/dashboard.go:79
github.com/spf13/cobra.(*Command).execute
/home/jaime/gocode/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:766
github.com/spf13/cobra.(*Command).ExecuteC
/home/jaime/gocode/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:852
github.com/spf13/cobra.(*Command).Execute
/home/jaime/gocode/src/github.com/elastic/beats/vendor/github.com/spf13/cobra/command.go:800
main.main
/home/jaime/gocode/src/github.com/elastic/beats/metricbeat/main.go:34
runtime.main
/home/jaime/go/src/runtime/proc.go:203
runtime.goexit
/home/jaime/go/src/runtime/asm_amd64.s:1357.
Some commands fail with stack traces, they should fail with a friendlier message and use a logger.
For example it happens with export commands like
metricbeat export dashboard -id not-exist, that fails with messages like: