]> git.r.bdr.sh - rbdr/mobius/blame_incremental - hotline/panic.go
Extensive refactor, quality of life enhancements
[rbdr/mobius] / hotline / panic.go
... / ...
CommitLineData
1package hotline
2
3import (
4 "fmt"
5 "log/slog"
6 "runtime/debug"
7)
8
9// dontPanic logs panics instead of crashing
10func dontPanic(logger *slog.Logger) {
11 if r := recover(); r != nil {
12 fmt.Println("stacktrace from panic: \n" + string(debug.Stack()))
13 logger.Error("PANIC", "err", r, "trace", string(debug.Stack()))
14 }
15}