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 - an unknown transaction mode, the name a NameSpace or a TypeName is built with - 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, a number out of its range included, 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 name it registers (a structure’s, a field’s) and breaks its rules, a name it looks up and does not hold (Codec.check).

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.