mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-06 09:42:02 +00:00
feat: modify error handling to return a list of errors to display to the user at the end of analysis without blocking it if an error is detected (e.g., version of an object is not available on user's cluster)
Signed-off-by: Matthis <matthish29@gmail.com>
This commit is contained in:
@@ -55,12 +55,14 @@ func (s *Config) analyzeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
err = config.RunAnalysis()
|
||||
if err != nil {
|
||||
color.Red("Error: %v", err)
|
||||
analysisErrors := config.RunAnalysis()
|
||||
if analysisErrors != nil {
|
||||
var errorMessage string
|
||||
for _, err := range analysisErrors {
|
||||
errorMessage += err.Error() + "\n"
|
||||
}
|
||||
http.Error(w, errorMessage, http.StatusInternalServerError)
|
||||
health.Failure++
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
if explain {
|
||||
|
Reference in New Issue
Block a user