Serge Bazanski | cc25bdf | 2018-10-25 14:02:58 +0200 | [diff] [blame] | 1 | package jlexer |
2 | |||||
3 | import "fmt" | ||||
4 | |||||
5 | // LexerError implements the error interface and represents all possible errors that can be | ||||
6 | // generated during parsing the JSON data. | ||||
7 | type LexerError struct { | ||||
8 | Reason string | ||||
9 | Offset int | ||||
10 | Data string | ||||
11 | } | ||||
12 | |||||
13 | func (l *LexerError) Error() string { | ||||
14 | return fmt.Sprintf("parse error: %s near offset %d of '%s'", l.Reason, l.Offset, l.Data) | ||||
15 | } |