Skip to content

Commit

Permalink
feat: panic handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakiyo committed Aug 22, 2023
1 parent 2c0091c commit 657fc63
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
// Fast tldr console client
package main

import "github.com/Yakiyo/tilde/cmd"
import (
"github.com/Yakiyo/tilde/cmd"
"github.com/charmbracelet/log"
)

func main() {
defer panicHandler()

cmd.Execute()
}

// handle unexpected panics
func panicHandler() {
if err := recover(); err != nil {
log.Error("Unhandled error cause panic. Please consider filing a bug at https://github.com/Yakiyo/tilde")
log.Fatal(err)
}
}

0 comments on commit 657fc63

Please # to comment.