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:
2026-05-18 00:07:39 +09:00
parent f24ae21af1
commit 3e236333a7
3 changed files with 217 additions and 195 deletions

View File

@@ -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()