Skip to content

Commit

Permalink
Version v1.0.2
Browse files Browse the repository at this point in the history
* Fixes broken releases
  • Loading branch information
comstud committed Jul 11, 2024
1 parent bf2298b commit f5f346b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions util/panic.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package util

import (
"encoding/json"
"runtime/debug"
"strings"

"github.com/sirupsen/logrus"
)

var panicLogger *logrus.Logger

func SetPanicLogger(logger *logrus.Logger) {
panicLogger = logger
}

func HandlePanic() {
logger := panicLogger
if logger != nil {
if rerr := recover(); rerr != nil {
stack := debug.Stack()
jsonStack, err := json.Marshal(strings.Split(string(stack), "\n"))
if err != nil {
jsonStack = stack
}
logger.Errorf("Ruh roh. A panic has occurred: %v, trace: %s", rerr, string(jsonStack))
panic(rerr)
}
}
}
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package version

const (
APP_VERSION = "1.0.1"
APP_VERSION = "1.0.2"
)

0 comments on commit f5f346b

Please sign in to comment.