forked from rosa/hakurei
internal/rosa: panic error for invalid handle
This enables recovery and better error handling for errors originating from external azalea files. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -58,6 +58,19 @@ func main() {
|
||||
log.Fatal("this program must not run as root")
|
||||
}
|
||||
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
|
||||
h, ok := r.(rosa.HandleError)
|
||||
if !ok {
|
||||
panic(r)
|
||||
}
|
||||
log.Fatal(h)
|
||||
}()
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(),
|
||||
syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||
defer stop()
|
||||
|
||||
Reference in New Issue
Block a user