Alerting: Improve errors from failed requests in historian app.

Passing an empty body to the query handler would result in the rather unhelpful
response of "EOF", so add some prefixes to errors in useful places.
This commit is contained in:
Steve Simpson
2025-12-11 20:16:32 +00:00
parent fe4c615b3d
commit a6e9e2e49b
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"github.com/grafana/grafana-app-sdk/app"
@@ -49,7 +50,7 @@ func (n *Notification) QueryHandler(ctx context.Context, writer app.CustomRouteR
ErrStatus: metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusBadRequest,
Message: err.Error(),
Message: fmt.Sprintf("parse request: %s", err.Error()),
}}
}
@@ -67,7 +68,7 @@ func (n *Notification) QueryHandler(ctx context.Context, writer app.CustomRouteR
ErrStatus: metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusInternalServerError,
Message: err.Error(),
Message: fmt.Sprintf("notification query: %s", err.Error()),
}}
}