jsonyx.TruncatedSyntaxError

exception jsonyx.TruncatedSyntaxError(msg, filename, doc, start=0, end=0)

Bases: SyntaxError

Syntax error trucated to fit within the terminal width.

Added in version 2.0.

Parameters:
  • msg (str) – an error message

  • filename (str) – the path to the file

  • doc (str) – a string

  • start (int, default: 0) – the start position

  • end (int, default: 0) – the end position or negative offset

Example:
>>> import jsonyx as json
>>> raise json.TruncatedSyntaxError("msg", "<string>", "c" * 998, 0, 998)
Traceback (most recent call last):
  File "<string>", line 1, column 1-999
    ccccccccccccccccccccccccccccccccccc...cccccccccccccccccccccccccccccccccc
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jsonyx.TruncatedSyntaxError: msg

Tip

Set the COLUMNS environment variable to overwrite the width.

See also

jsonyx.format_syntax_error() for formatting the exception.