We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8e23736 commit 6990789Copy full SHA for 6990789
1 file changed
api/index.go
@@ -54,10 +54,19 @@ func Handler(w http.ResponseWriter, r *http.Request) {
54
})
55
56
if initErr != nil {
57
+ reason := "internal"
58
+ errText := strings.ToLower(initErr.Error())
59
+ if strings.Contains(errText, "load config") {
60
+ reason = "config"
61
+ } else if strings.Contains(errText, "connect database") || strings.Contains(errText, "postgres") {
62
+ reason = "database"
63
+ }
64
+
65
w.Header().Set("Content-Type", "application/json")
66
w.WriteHeader(http.StatusInternalServerError)
- _ = json.NewEncoder(w).Encode(map[string]string{
- "error": "backend initialization failed",
67
+ _ = json.NewEncoder(w).Encode(map[string]any{
68
+ "error": "backend initialization failed",
69
+ "reason": reason,
70
71
return
72
}
0 commit comments