Skip to content

Exceptions

These are all the exceptions raised by the library.

pyown.exceptions.OWNException

Bases: Exception

Base exception for all exceptions in the pyown package.

This exception should not be raised directly. It is useful for catching all exceptions in the package.

pyown.exceptions.ParseError

Bases: OWNException

Raised when an error occurs while parsing a message or a tag.

It is a generic exception and should not be raised directly.

pyown.exceptions.InvalidData

InvalidData(data: bytes)

Bases: ParseError

Raised when an error occurs when not valid data or characters not allowed are received. This should not happen with official gateways.

Parameters:

Name Type Description Default
data bytes

The data that caused the error.

required

pyown.exceptions.InvalidMessage

InvalidMessage(message: str | list[str])

Bases: ParseError

Raised when a message does not follow the protocol standards.

Parameters:

Name Type Description Default
message str | list[str]

The message or tags that caused the error.

required

pyown.exceptions.InvalidTag

InvalidTag(tag: Any)

Bases: ParseError

Raised when a tag is not valid or does not follow the protocol standards.

Parameters:

Name Type Description Default
tag Any

The tag that caused the error.

required

pyown.exceptions.InvalidSession

Bases: OWNException

Raised when a command is sent using an event session or when event methods are called using a command session.

pyown.exceptions.InvalidAuthentication

Bases: OWNException

Raised when the authentication fails or an unsupported authentication method is used.

pyown.exceptions.ResponseError

Bases: OWNException

Raised when an error the server responds with a NACK or responds with an unexpected message.