diff --git a/rules/ast/printer.go b/rules/ast/printer.go index 17c17fcec..d39fcbe00 100644 --- a/rules/ast/printer.go +++ b/rules/ast/printer.go @@ -132,10 +132,10 @@ func (matrix Matrix) ToString() string { func ErrorToJSON(err error) string { errorStruct := struct { Type string - Error string + Value string }{ Type: "error", - Error: err.Error(), + Value: err.Error(), } errorJSON, err := json.MarshalIndent(errorStruct, "", "\t") diff --git a/static/js/rickshaw.js b/static/js/rickshaw.js index a2e286a6e..13b318dd7 100644 --- a/static/js/rickshaw.js +++ b/static/js/rickshaw.js @@ -84,6 +84,10 @@ function submitQuery() { dataType: "json", data: form.serialize(), success: function(json, textStatus) { + if (json.Type == "error") { + alert(json.Value); + return; + } data = transformData(json); if (data.length == 0) { alert("No datapoints found.");