Skip to content

Exceptions module

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


              flowchart TD
              pyown.exceptions.ParseError[ParseError]
              pyown.exceptions.OWNException[OWNException]

                              pyown.exceptions.OWNException --> pyown.exceptions.ParseError
                


              click pyown.exceptions.ParseError href "" "pyown.exceptions.ParseError"
              click pyown.exceptions.OWNException href "" "pyown.exceptions.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


              flowchart TD
              pyown.exceptions.InvalidData[InvalidData]
              pyown.exceptions.ParseError[ParseError]
              pyown.exceptions.OWNException[OWNException]

                              pyown.exceptions.ParseError --> pyown.exceptions.InvalidData
                                pyown.exceptions.OWNException --> pyown.exceptions.ParseError
                



              click pyown.exceptions.InvalidData href "" "pyown.exceptions.InvalidData"
              click pyown.exceptions.ParseError href "" "pyown.exceptions.ParseError"
              click pyown.exceptions.OWNException href "" "pyown.exceptions.OWNException"
            

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


              flowchart TD
              pyown.exceptions.InvalidMessage[InvalidMessage]
              pyown.exceptions.ParseError[ParseError]
              pyown.exceptions.OWNException[OWNException]

                              pyown.exceptions.ParseError --> pyown.exceptions.InvalidMessage
                                pyown.exceptions.OWNException --> pyown.exceptions.ParseError
                



              click pyown.exceptions.InvalidMessage href "" "pyown.exceptions.InvalidMessage"
              click pyown.exceptions.ParseError href "" "pyown.exceptions.ParseError"
              click pyown.exceptions.OWNException href "" "pyown.exceptions.OWNException"
            

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


              flowchart TD
              pyown.exceptions.InvalidTag[InvalidTag]
              pyown.exceptions.ParseError[ParseError]
              pyown.exceptions.OWNException[OWNException]

                              pyown.exceptions.ParseError --> pyown.exceptions.InvalidTag
                                pyown.exceptions.OWNException --> pyown.exceptions.ParseError
                



              click pyown.exceptions.InvalidTag href "" "pyown.exceptions.InvalidTag"
              click pyown.exceptions.ParseError href "" "pyown.exceptions.ParseError"
              click pyown.exceptions.OWNException href "" "pyown.exceptions.OWNException"
            

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


              flowchart TD
              pyown.exceptions.InvalidSession[InvalidSession]
              pyown.exceptions.OWNException[OWNException]

                              pyown.exceptions.OWNException --> pyown.exceptions.InvalidSession
                


              click pyown.exceptions.InvalidSession href "" "pyown.exceptions.InvalidSession"
              click pyown.exceptions.OWNException href "" "pyown.exceptions.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


              flowchart TD
              pyown.exceptions.InvalidAuthentication[InvalidAuthentication]
              pyown.exceptions.OWNException[OWNException]

                              pyown.exceptions.OWNException --> pyown.exceptions.InvalidAuthentication
                


              click pyown.exceptions.InvalidAuthentication href "" "pyown.exceptions.InvalidAuthentication"
              click pyown.exceptions.OWNException href "" "pyown.exceptions.OWNException"
            

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

pyown.exceptions.ResponseError

Bases: OWNException


              flowchart TD
              pyown.exceptions.ResponseError[ResponseError]
              pyown.exceptions.OWNException[OWNException]

                              pyown.exceptions.OWNException --> pyown.exceptions.ResponseError
                


              click pyown.exceptions.ResponseError href "" "pyown.exceptions.ResponseError"
              click pyown.exceptions.OWNException href "" "pyown.exceptions.OWNException"
            

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