Commit e5fbbe96 by Torkel Ödegaard

fixed error handling, and error logging for panel rendering

parent 8e1b7536
grafana @ d5471c15
Subproject commit d5471c153ab8ab0d4be57154300d28a75af1d363
...@@ -20,10 +20,11 @@ func RenderToPng(c *middleware.Context) { ...@@ -20,10 +20,11 @@ func RenderToPng(c *middleware.Context) {
} }
renderOpts.Url = "http://localhost:3000/" + renderOpts.Url renderOpts.Url = "http://localhost:3000/" + renderOpts.Url
pngPath, err := renderer.RenderToPng(renderOpts) pngPath, err := renderer.RenderToPng(renderOpts)
if err != nil { if err != nil {
c.HTML(500, "error.html", nil) c.Handle(500, "Failed to render to png", err)
return
} }
c.Resp.Header().Set("Content-Type", "image/png") c.Resp.Header().Set("Content-Type", "image/png")
......
...@@ -88,12 +88,7 @@ func (ctx *Context) Handle(status int, title string, err error) { ...@@ -88,12 +88,7 @@ func (ctx *Context) Handle(status int, title string, err error) {
} }
} }
switch status { ctx.Data["Title"] = title
case 404:
ctx.Data["Title"] = "Page Not Found"
case 500:
ctx.Data["Title"] = "Internal Server Error"
}
ctx.HTML(status, strconv.Itoa(status)) ctx.HTML(status, strconv.Itoa(status))
} }
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
</div> </div>
<br> <br>
<panel-loader type="'test'"></panel-loader>
<br> <br>
<button type="submit" class="pull-right btn btn-success" ng-click="update()">Update</button> <button type="submit" class="pull-right btn btn-success" ng-click="update()">Update</button>
</form> </form>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>Grafana</title>
<link rel="stylesheet" href="[[.AppSubUrl]]/css/grafana.dark.min.css" title="Dark">
<link rel="icon" type="image/png" href="[[.AppSubUrl]]/img/fav32.png">
</head>
<body>
<div class="gf-box" style="margin: 200px auto 0 auto; width: 500px;">
<div class="gf-box-header">
<span class="gf-box-title">
Server side error :(
</span>
</div>
<div class="gf-box-body">
<h4>[[.Title]]</h4>
[[.ErrorMsg]]
</div>
</div>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment