Skip to content

Commit

Permalink
tomlv: print more detailed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed May 26, 2024
1 parent 092fca1 commit 14f5b21
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/tomlv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main

import (
"encoding/json"
"errors"
"flag"
"fmt"
"log"
Expand Down Expand Up @@ -45,6 +46,10 @@ func main() {
start := time.Now()
md, err := toml.DecodeFile(f, &tmp)
if err != nil {
var perr toml.ParseError
if errors.As(err, &perr) {
log.Fatalf("Error in '%s': %s", f, perr.ErrorWithPosition())
}
log.Fatalf("Error in '%s': %s", f, err)
}
if flagTime {
Expand Down

0 comments on commit 14f5b21

Please sign in to comment.