Skip to content

Commit

Permalink
printing version in the error
Browse files Browse the repository at this point in the history
  • Loading branch information
ascandone committed Jul 24, 2024
1 parent 5555e4a commit e2107c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import (
"github.com/getsentry/sentry-go"
)

// This has to be set dynamically via the following flag:
// -ldflags "-X main.Version=0.0.1"
var Version string = "develop"

var pathFlag = flag.String("path", "", "path to execute")

func recoverPanic() {
Expand All @@ -20,7 +24,7 @@ func recoverPanic() {
return
}

errMsg := fmt.Sprintf("[uncaught panic]: %s\n%s\n", r, string(debug.Stack()))
errMsg := fmt.Sprintf("[uncaught panic]@v%s: %s\n%s\n", Version, r, string(debug.Stack()))
os.Stderr.Write([]byte(errMsg))
sentry.CaptureMessage(errMsg)
sentry.Flush(2 * time.Second)
Expand Down

0 comments on commit e2107c7

Please sign in to comment.