-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Labels
Description
Problem
I noticed that this error doesn't get printed to stderr:
invalid private key for account: emulator-account
After some investigation, I saw that most of the errors caught at the top level (e.g. when triggering the emulator start command) are written to stdout instead of stderr, because this utility is used:
flow-cli/pkg/flowkit/util/cli.go
Lines 32 to 35 in 30e91b0
| func Exit(code int, msg string) { | |
| fmt.Println(msg) | |
| os.Exit(code) | |
| } |
I think that it would be nice if we write all error messages to stderr as a general practice. Some benefits of this:
- some dev tools (like Flowser) can automatically detect errors and provide better feedback to the user
- users running the
flow emulatorcommand, can filter error logs (e.g.flow emulator > emulator.log 2> emulator-error.log)
Steps to Reproduce
- Run the emulator
- Trigger an error (e.g. provide an invalid key in flow.json)
Acceptance Criteria
Flow-cli error logs are written to STDERR.
Context
I'm working on Flowser tool, which automatically detects errors (those logs emitted to stderr) and provides a visual feedback to the user.
bluesign