dsviper.ViperError

exception dsviper.ViperError

The exception a failing call raises, where Python has no name of its own for it.

Its message carries the structured error the C++ side produced. Pass it to Error.parse(str(exc)) to read the component, domain, code and message apart.

A call crosses three layers, and what it raises says which refused:

  • the signature: an argument of the wrong kind - another class, a missing argument, an unknown keyword - raises TypeError, and a value checked alone, such as an unknown mode, raises ValueError. Their messages are plain, and Error.parse answers None;

  • the conversion of a Python native into a typed value: content that does not fit the type raises ViperError, whose message names the type expected, what was given, and the path to the element at fault;

  • the runtime: an operation it refuses raises ViperError.

A read keeps the name Python has for it, whichever layer finds it: an index past the end raises IndexError, a missing key raises KeyError.