Add utils.Fatal, a print-to-stderr-and-exit helper

pull/2034/head
Eugene Kim 5 years ago
parent e7cd387677
commit f455056d25
  1. 6
      internal/utils/utils.go

@ -273,6 +273,12 @@ func AppendIfMissing(slice []common.Address, addr common.Address) []common.Addre
return append(slice, addr)
}
// Fatal prints the given message onto stderr, then exits with status 1.
func Fatal(format string, args ...interface{}) {
_, _ = fmt.Fprintf(os.Stderr, format, args...)
os.Exit(1)
}
// PrintError prints the given error in the extended format (%+v) onto stderr.
func PrintError(err error) {
_, _ = fmt.Fprintf(os.Stderr, "%+v\n", err)

Loading…
Cancel
Save