Error

class dsviper.Error(module, domain, code, message)

Bases: object

Reads a Viper error: component, domain, code and message.

It is not what a failing call raises; ViperError says which exception each layer of a call raises. Pass str() of the exception to Error.parse to read the four fields apart - on a KeyError pass exc.args[0] instead, since its str() quotes the message. A plain message, which a refusal of the signature carries, parses to None.

code() → int

Return the numeric code, unique within the domain.

component() → str

Return the component the error comes from, such as Viper.CommitDatabase.

domain() → str

Return the error domain, which names the family the code belongs to.

explained() → str

Return the structured description, which parse() reads back.

[host@process]:Component:Domain:Code:Message

hostname() → str

Return the host the error was raised on - the remote one when it came over RPC.

message() → str

Return the sentence describing what failed.

static parse(description: str) → Error | None

Return the Error description encodes, or None if it is not one.

The inverse of explained(), used to carry an error across RPC.

process_name() → str

Return the process the error was raised in, as set by Error.set_process_name().

static set_process_name(name: str) → None

Assign the name of the process reported in Error.