summaryrefslogtreecommitdiff
path: root/frontend.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-11-17 16:29:37 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-11-17 16:29:37 -0500
commitd9498148b860252c6f80eb6cd5acbd9fe07b2b8b (patch)
tree61ef914767f07df85688ccd7187da48efca25b64 /frontend.go
parent5b3b19e1280ac879567f9299639f60e5b1dd0c14 (diff)
error callbacks
Diffstat (limited to 'frontend.go')
-rw-r--r--frontend.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/frontend.go b/frontend.go
index 0b10f65..2150a35 100644
--- a/frontend.go
+++ b/frontend.go
@@ -38,7 +38,7 @@ type Frontend struct {
err error
}
-func NewFrontend(fastImport io.Reader, catBlob io.Writer) *Frontend {
+func NewFrontend(fastImport io.Reader, catBlob io.Writer, onErr func(error) error) *Frontend {
ret := &Frontend{}
ret.fir = textproto.NewFIReader(fastImport)
if catBlob == nil {
@@ -49,6 +49,9 @@ func NewFrontend(fastImport io.Reader, catBlob io.Writer) *Frontend {
ret.cmd = make(chan Cmd)
go func() {
ret.err = ret.parse()
+ if onErr != nil {
+ ret.err = onErr(ret.err)
+ }
close(ret.cmd)
}()
return ret