Release 5.0.2 with error source fix for some downstream errors (#1980)

This PR fixes error source for 2 errors:
- parsing of invalid json response should be downstream error as we
expect to receive valid json from zabbix
- no host found error should be downstream. We are bumping sdk that
includes that fix
https://github.com/grafana/grafana-plugin-sdk-go/pull/1246.

As you can see - the invalid json parsing is now downstream error
<img width="1498" alt="image"
src="https://github.com/user-attachments/assets/88028dbe-0f73-47aa-8262-5729059ce12f"
/>
This commit is contained in:
Ivana Huckova
2025-02-27 12:30:19 +01:00
committed by GitHub
parent d28a715bb1
commit 58902e7ed9
9 changed files with 84 additions and 26 deletions

View File

@@ -196,7 +196,8 @@ func isDeprecatedUserParamError(err error) bool {
func handleAPIResult(response []byte) (*simplejson.Json, error) {
jsonResp, err := simplejson.NewJson([]byte(response))
if err != nil {
return nil, err
// Response is not valid JSON
return nil, backend.DownstreamError(err)
}
if errJSON, isError := jsonResp.CheckGet("error"); isError {
errMessage := fmt.Errorf("%s %s", errJSON.Get("message").MustString(), errJSON.Get("data").MustString())