Skip to content

Commit

Permalink
Added section handler error
Browse files Browse the repository at this point in the history
  • Loading branch information
jubeless committed Oct 13, 2020
1 parent a8a734a commit 63c34d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion snapshot/reader.go
Expand Up @@ -3,6 +3,7 @@ package snapshot
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -98,10 +99,12 @@ func (r *Reader) readHeader() (*Header, error) {
return h, nil
}

var SectionHandlerNotFound = errors.New("section handler not found")

func (r *Reader) ProcessCurrentSection(f sectionCallbackFunc) error {
h, found := r.handlers[r.CurrentSection.Name]
if !found {
return fmt.Errorf("section handler not found: %q", r.CurrentSection.Name)
return SectionHandlerNotFound
}
return h(r.CurrentSection, f)
}
Expand Down

0 comments on commit 63c34d3

Please sign in to comment.