fixed error handling, and error logging for panel rendering

This commit is contained in:
Torkel Ödegaard 2015-02-05 12:23:24 +01:00
parent 8e1b753664
commit e5fbbe96fd
7 changed files with 36 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

@ -1 +0,0 @@
Subproject commit d5471c153ab8ab0d4be57154300d28a75af1d363

View File

@ -20,10 +20,11 @@ func RenderToPng(c *middleware.Context) {
}
renderOpts.Url = "http://localhost:3000/" + renderOpts.Url
pngPath, err := renderer.RenderToPng(renderOpts)
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")

View File

@ -88,12 +88,7 @@ func (ctx *Context) Handle(status int, title string, err error) {
}
}
switch status {
case 404:
ctx.Data["Title"] = "Page Not Found"
case 500:
ctx.Data["Title"] = "Internal Server Error"
}
ctx.Data["Title"] = title
ctx.HTML(status, strconv.Itoa(status))
}

View File

@ -22,8 +22,6 @@
</div>
<br>
<panel-loader type="'test'"></panel-loader>
<br>
<button type="submit" class="pull-right btn btn-success" ng-click="update()">Update</button>
</form>

32
src/views/500.html Normal file
View File

@ -0,0 +1,32 @@
<!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>