From d88ba0ead310ef3e6a2afc21a042cf0b5119957b Mon Sep 17 00:00:00 2001 From: Will Charczuk Date: Wed, 22 Feb 2017 17:15:13 -0800 Subject: [PATCH] removing exception dep, saving blank canvas on checkRanges err --- _examples/basic/main.go | 3 ++- chart.go | 2 ++ file_util.go | 6 ++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/_examples/basic/main.go b/_examples/basic/main.go index 2e86ac5..215c4e4 100644 --- a/_examples/basic/main.go +++ b/_examples/basic/main.go @@ -1,6 +1,7 @@ package main import ( + "log" "net/http" "github.com/wcharczuk/go-chart" @@ -38,5 +39,5 @@ func drawChartWide(res http.ResponseWriter, req *http.Request) { func main() { http.HandleFunc("/", drawChart) http.HandleFunc("/wide", drawChartWide) - http.ListenAndServe(":8080", nil) + log.Fatal(http.ListenAndServe(":8080", nil)) } diff --git a/chart.go b/chart.go index 7dee166..9d00254 100644 --- a/chart.go +++ b/chart.go @@ -97,6 +97,8 @@ func (c Chart) Render(rp RendererProvider, w io.Writer) error { err = c.checkRanges(xr, yr, yra) if err != nil { + // (try to) dump the raw background to the stream. + r.Save(w) return err } diff --git a/file_util.go b/file_util.go index 7fd66bf..504f3de 100644 --- a/file_util.go +++ b/file_util.go @@ -4,8 +4,6 @@ import ( "bufio" "io" "os" - - exception "github.com/blendlabs/go-exception" ) var ( @@ -26,7 +24,7 @@ func (fu fileUtil) ReadByLines(filePath string, handler func(line string)) error handler(line) } } else { - return exception.Wrap(err) + return err } return nil } @@ -46,7 +44,7 @@ func (fu fileUtil) ReadByChunks(filePath string, chunkSize int, handler func(lin handler(readData) } } else { - return exception.Wrap(err) + return err } return nil }