1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-11-29 22:47:29 +02:00

Emit error tokens when there's a group mismatch.

Also don't panic/recover, as we no longer use panic to report "real"
errors.

Fixes #295.
This commit is contained in:
Alec Thomas
2019-10-24 17:02:24 +11:00
parent a1c4eaa235
commit bbc59ac372
9 changed files with 12 additions and 29 deletions

View File

@@ -91,11 +91,6 @@ func (h highlightRanges) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
func (h highlightRanges) Less(i, j int) bool { return h[i][0] < h[j][0] }
func (f *Formatter) Format(w io.Writer, style *chroma.Style, iterator chroma.Iterator) (err error) {
defer func() {
if perr := recover(); perr != nil {
err = perr.(error)
}
}()
return f.writeHTML(w, style, iterator.Tokens())
}