Skip to content

xtr_remote_event.exception

Every error this package raises, each deriving from :class:RemoteEventError.

InvalidArgumentError

Bases: RemoteEventError, ValueError

A value handed to this library cannot be used: a consumer name, a payload.

Also a :class:ValueError, so code that already guards what it was given with except ValueError keeps working without learning a new exception.

LogicError

Bases: RemoteEventError, RuntimeError

This library was asked for something no input could make right.

An event arriving for a source nothing is registered under is the case this exists for: the payload was fine, the application simply has no consumer for it — a wiring mistake, not a bad request.

Also a :class:RuntimeError, because that is what a worker's own error handling already catches.

ParseError

Bases: InvalidArgumentError

A converter was handed a payload it cannot read as an event.

A kind of invalid argument, and typed separately because the caller does something different about it: a payload that cannot be read is the sender's doing, and the answer is to tell the sender, not to fix the application.

RemoteEventError

Bases: Exception

Something this library could not do — catch this to catch them all.

Code receiving events from elsewhere is usually on the edge of the application, where one except has to answer the sender. This is that one: catch it to turn any failure of this library into a reply, catch a subclass to tell a payload that cannot be read from a source nobody answers for.