feat: handle panic (#254)

This commit is contained in:
Louis
2023-12-09 11:56:30 -08:00
committed by GitHub
parent 4f053d338f
commit 1a5d58e3cf
4 changed files with 102 additions and 1 deletions

23
utils/debug/debug.go Normal file
View File

@@ -0,0 +1,23 @@
package debug
import (
"fmt"
)
var (
PanicError = fmt.Errorf("panic")
)
type PanicErrorMessage struct {
Msg interface{}
Inner string
Stacktrace []byte
}
func (e *PanicErrorMessage) Error() string {
return fmt.Sprintf("%s", e.Inner)
}
func (e *PanicErrorMessage) Unwrap() []error {
return []error{PanicError}
}