Report panic details (stack trace w/args&stdin) to clients; drop synccycles.StringGen() (moved to go-boilerplate)

This commit is contained in:
2025-12-11 18:23:01 -05:00
parent 7e7fbd15b4
commit 4e6c18db8a
7 changed files with 20 additions and 76 deletions
+9
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"os"
"runtime/debug"
"strings"
"github.com/rwinkhart/go-boilerplate/back"
@@ -33,6 +34,14 @@ func main() {
}
}
// allow reporting panic details to clients
defer func() {
if r := recover(); r != nil {
fmt.Printf("{\"errMsg\":\"SERVER-SIDE PANIC OCCURRED!%sARGS: (%v)%sSTDIN: (%v)%sSTACK TRACE: %s\"}", global.FSSpace, os.Args, global.FSSpace, stdin, global.FSSpace, strings.ReplaceAll(strings.ReplaceAll(string(debug.Stack()), "\n", global.FSSpace), "\t", ""))
return
}
}()
switch args[1] {
case "fetch":
// print all information needed for syncing to stdout for interpretation by the client