Skip to content

Commit

Permalink
tools/j2y2j: fix dropped error (#402)
Browse files Browse the repository at this point in the history
tools/j2y2j: log clearer error messages
  • Loading branch information
alrs authored Aug 25, 2023
1 parent 836f55b commit 65eab73
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/j2y2j/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path"

Expand Down Expand Up @@ -49,11 +50,13 @@ func main() {
filename := os.Args[1]
file, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
log.Fatalf("error reading file: %v", err)
}
var node yaml.Node
err = yaml.Unmarshal(file, &node)

if err != nil {
log.Fatalf("error unmarshaling yaml file: %v", err)
}
dump(&node, "")

switch os.Args[2] {
Expand All @@ -63,7 +66,7 @@ func main() {
case "--yaml":
result, err := yaml.Marshal(&node)
if err != nil {
panic(err)
log.Fatalf("error marshaling yaml: %v", err)
}
fmt.Printf("%s", string(result))
default:
Expand Down

0 comments on commit 65eab73

Please sign in to comment.