finesse.script.exceptions module
Kat script exceptions.
These are special exceptions that add extra context-specific information when errors occur during parsing or unparsing.
- exception finesse.script.exceptions.KatMissingAfterDirective(container, directive)[source]
Bases:
KatSyntaxErrorError for when an element name or function ‘(’ is missing.
- exception finesse.script.exceptions.KatParsingError(message, **kwargs)[source]
Bases:
FinesseExceptionAn error during the parsing process.
This handles errors raised by the tokenizer, parser and builder. These are, confusingly, collectively referred to as the “parser”.
- exception finesse.script.exceptions.KatParsingInputSizeWarning[source]
Bases:
UserWarningWarns the users of an unreasonable input size, either the in the total size of the katscript or the length of an individual line.
Both of these might lead to recursion errors or low performance.
- exception finesse.script.exceptions.KatParsingWarning[source]
Bases:
UserWarningA warning during the parsing, indicating that exceptions might occur later.
- exception finesse.script.exceptions.KatScriptError(error, container, error_items, syntax=None)[source]
Bases:
KatParsingErrorDetailed kat script error.
Parameters
- errorstr or
Exception The error or error message.
- container
Addressable The kat script container, used to show lines before/after error lines if requested.
- error_itemssequence of sequences of
Addressable The error(s) to show. Each item of the topmost sequence should itself be an ordered sequence of
Addressableobjects in increasing order of depth. The last item is considered to be where the error occurred, but the start and end lines (plus optional buffer) of each of the other items are also shown.- syntax
str, optional Syntax suggestion to display to the user.
- MAX_BUFFER_LINES = 1
- chunkify()[source]
Convert the error script into a dict of line numbers to (str, is_error) sequences.
Each (str, is_error) chunk contains a piece of the script specified in error_items, with the is_error flag set depending on whether each error item appeared last in a error_items sequence, which specifies that it is an error as opposed to just useful related code.
Returns
- errorstr or
- exception finesse.script.exceptions.KatSyntaxError(message, script, token)[source]
Bases:
KatScriptErrorError with kat syntax.