Skip to content

Commit

Permalink
Merge pull request #1237 from bosun-monitor/recoverGraph
Browse files Browse the repository at this point in the history
cmd/bosun: recovering from panic in chart rendering.
  • Loading branch information
kylebrandt committed Aug 7, 2015
2 parents ad71c06 + c4c69e1 commit 2dcd6d9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/bosun/sched/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bosun.org/cmd/bosun/expr"
"bosun.org/cmd/bosun/expr/parse"
"bosun.org/opentsdb"
"bosun.org/slog"
)

type Context struct {
Expand Down Expand Up @@ -290,7 +291,13 @@ func (c *Context) EvalAll(v interface{}) (interface{}, error) {
return res, err
}

func (c *Context) graph(v interface{}, unit string, filter bool) (interface{}, error) {
func (c *Context) graph(v interface{}, unit string, filter bool) (val interface{}, err error) {
defer func() {
if p := recover(); p != nil {
slog.Error("panic rendering graph", p)
val = "error rendering graph"
}
}()
res, exprText, err := c.eval(v, filter, true, 1000)
if err != nil {
return nil, err
Expand Down

0 comments on commit 2dcd6d9

Please sign in to comment.