mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix: check strconv.Atoi and json.Unmarshal errors
short_retrieval.go: Check Atoi error even though regex ensures numeric input. gateway.go: Log warning when gateway config JSON is malformed instead of silently using defaults.
This commit is contained in:
@@ -88,7 +88,12 @@ func ResolveGatewayLogLevel(path string) string {
|
||||
|
||||
data, err := os.ReadFile(path)
|
||||
if err == nil {
|
||||
_ = json.Unmarshal(data, &cfg)
|
||||
if err := json.Unmarshal(data, &cfg); err != nil {
|
||||
logger.WarnCF("config", "failed to parse gateway config, using defaults", map[string]any{
|
||||
"path": path,
|
||||
"error": err.Error(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if envLevel := os.Getenv("PICOCLAW_LOG_LEVEL"); envLevel != "" {
|
||||
|
||||
Reference in New Issue
Block a user