Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed end: The end index of doc where parsing failed (may be None) lineno: The line corresponding to
| 30 | |
| 31 | |
| 32 | class JSONDecodeError(ValueError): |
| 33 | """Subclass of ValueError with the following additional properties: |
| 34 | |
| 35 | msg: The unformatted error message |
| 36 | doc: The JSON document being parsed |
| 37 | pos: The start index of doc where parsing failed |
| 38 | end: The end index of doc where parsing failed (may be None) |
| 39 | lineno: The line corresponding to pos |
| 40 | colno: The column corresponding to pos |
| 41 | endlineno: The line corresponding to end (may be None) |
| 42 | endcolno: The column corresponding to end (may be None) |
| 43 | |
| 44 | """ |
| 45 | def __init__(self, msg, doc, pos, end=None): |
| 46 | ValueError.__init__(self, errmsg(msg, doc, pos, end=end)) |
| 47 | self.msg = msg |
| 48 | self.doc = doc |
| 49 | self.pos = pos |
| 50 | self.end = end |
| 51 | self.lineno, self.colno = linecol(doc, pos) |
| 52 | if end is not None: |
| 53 | self.endlineno, self.endcolno = linecol(doc, end) |
| 54 | else: |
| 55 | self.endlineno, self.endcolno = None, None |
| 56 | |
| 57 | |
| 58 | def linecol(doc, pos): |
no outgoing calls
no test coverage detected