cly.exceptions

CLY exception hierarchy.

class Error()

The base of all CLY exceptions.

class InvalidHelp()

Thrown when the help provided to a Node is of an invalid type.

class InvalidNodePath()

Thrown when an attempt is made to reference an invalid node path. This can occur when an Alias target is invalid.

class InvalidAnonymousNode()

When Node is used as a callable to add child nodes, positional arguments are treated as anonymous child nodes. This exception is thrown if an object that is not a Node is passed.

class XMLParseError()

Report an XML grammar parsing error.

class ParseError()

Report a parse error. Output is formatted using string templates, where template variables are passed as arguments to the constructor.

>>> from cly.parser import Context
>>> print ParseError(Context(None, 'foo bar'), "remaining=$remaining, time=$time", time=123)
remaining=foo bar, time=123

__init__(self, context, message=None, **kwargs)

(Not documented)

class UnexpectedEOL()

Raised when all input is consumed and no terminal (Action) node is reached.

class InvalidToken()

Raised when a token is reached that is invalid at the current grammar branch.

class ValidationError()

Raised when a variable fails to parse. In practise this is rare, as the regex for a variable is usually sufficient to rule it out of selection before parsing occurs.