removing exception dep, saving blank canvas on checkRanges err
This commit is contained in:
parent
a3605addc2
commit
d88ba0ead3
3 changed files with 6 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart"
|
"github.com/wcharczuk/go-chart"
|
||||||
|
@ -38,5 +39,5 @@ func drawChartWide(res http.ResponseWriter, req *http.Request) {
|
||||||
func main() {
|
func main() {
|
||||||
http.HandleFunc("/", drawChart)
|
http.HandleFunc("/", drawChart)
|
||||||
http.HandleFunc("/wide", drawChartWide)
|
http.HandleFunc("/wide", drawChartWide)
|
||||||
http.ListenAndServe(":8080", nil)
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
}
|
}
|
||||||
|
|
2
chart.go
2
chart.go
|
@ -97,6 +97,8 @@ func (c Chart) Render(rp RendererProvider, w io.Writer) error {
|
||||||
|
|
||||||
err = c.checkRanges(xr, yr, yra)
|
err = c.checkRanges(xr, yr, yra)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// (try to) dump the raw background to the stream.
|
||||||
|
r.Save(w)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
exception "github.com/blendlabs/go-exception"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -26,7 +24,7 @@ func (fu fileUtil) ReadByLines(filePath string, handler func(line string)) error
|
||||||
handler(line)
|
handler(line)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return exception.Wrap(err)
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -46,7 +44,7 @@ func (fu fileUtil) ReadByChunks(filePath string, chunkSize int, handler func(lin
|
||||||
handler(readData)
|
handler(readData)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return exception.Wrap(err)
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue