Skip to content

Commit

Permalink
fix: fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shuymn committed Sep 25, 2021
1 parent 0756d4d commit 105890c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions epub2txt.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,18 @@ func convert(book *epub.Book, nps []epub.NavPoint, w io.Writer) error {
if err != nil {
return err
}

// write to txt file
w.Write([]byte(txt))
_, err = w.Write([]byte(txt))
if err != nil {
return err
}

// convert recursively
if len(np.Points) > 0 {
convert(book, np.Points, w)
if err = convert(book, np.Points, w); err != nil {
return err
}
}
}
return nil
Expand Down

0 comments on commit 105890c

Please sign in to comment.