Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1647)

Unified Diff: mojom/mojom_parser/parse_cmd.go

Issue 1833493002: Replace ErrorExit with log.Fatal in the mojom tool. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojom/mojom_parser/mojom_main.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/parse_cmd.go
diff --git a/mojom/mojom_parser/parse_cmd.go b/mojom/mojom_parser/parse_cmd.go
index 1c94c2fb890b8b75f013301cb47f9a151d273bbe..08f83c084b31421bb3091fd43f213ac92fa8bab2 100644
--- a/mojom/mojom_parser/parse_cmd.go
+++ b/mojom/mojom_parser/parse_cmd.go
@@ -33,6 +33,7 @@ import (
"flag"
"fmt"
"io/ioutil"
+ "log"
"mojom/mojom_parser/mojom"
"mojom/mojom_parser/parser"
"mojom/mojom_parser/serialization"
@@ -103,7 +104,7 @@ func parseCmd(args []string) {
// Do the parsing
descriptor, err := parseDriver.ParseFiles(fileNames)
if err != nil {
- ErrorExit(fmt.Sprintf("%s", err.Error()))
+ log.Fatalln(err.Error())
} else if *debug {
fmt.Println("Parsing complete.")
}
@@ -111,7 +112,7 @@ func parseCmd(args []string) {
// Serialize the result.
bytes, debug_string, err := serialization.Serialize(descriptor, *debug)
if err != nil {
- ErrorExit(fmt.Sprintf("Serialization error: %s", err))
+ log.Fatalf("Serialization error: %s\n", err)
}
// In debug mode print out the debug information.
@@ -123,12 +124,12 @@ func parseCmd(args []string) {
if len(*outFile) == 0 {
w := bufio.NewWriter(os.Stdout)
if _, err := w.Write(bytes); err != nil {
- ErrorExit(fmt.Sprintf("Error writing output to standard out: %s.", *outFile, err.Error()))
+ log.Fatalf("Error writing output to standard out: %s.\n", err.Error())
}
w.Flush()
} else {
if err := ioutil.WriteFile(*outFile, bytes, os.ModePerm); err != nil {
- ErrorExit(fmt.Sprintf("Error writing output to %s: %s.", *outFile, err.Error()))
+ log.Fatalf("Error writing output to %s: %s.", *outFile, err.Error())
} else {
if *debug {
fmt.Printf("The output was written to %s.\n", *outFile)
« no previous file with comments | « mojom/mojom_parser/mojom_main.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698