Skip to content

Commit

Permalink
fix: 🐛 fix missing panic info
Browse files Browse the repository at this point in the history
  • Loading branch information
Equationzhao committed Feb 6, 2024
1 parent 7f034a2 commit 896d56a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func main() {
// catch panic and print stack trace and version info
defer func() {
catchPanic()
catchPanic(recover())
}()
// when build with tag `doc`, generate md and man file
if doc.Enable {
Expand All @@ -36,8 +36,8 @@ func main() {
}
}

func catchPanic() {
if err := recover(); err != nil {
func catchPanic(err any) {
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Version: v%s\n", cli.Version)
_, _ = fmt.Fprintf(os.Stderr, "Please file an issue at %s with the following panic info\n\n", util.MakeLink("https://github.com/Equationzhao/g/issues/new/choose", "Github Repo"))
_, _ = fmt.Fprintln(os.Stderr, cli.MakeErrorStr(fmt.Sprintf("error message:\n%v\n", err)))
Expand Down

0 comments on commit 896d56a

Please sign in to comment.