Exceptions

The base class for all smok exceptions is:

class smok.exceptions.SMOKClientError

Base class for all exceptions thrown by SMOK client

smok-client exceptions

If there’s a problem with your certificate, the following will be raised:

class smok.exceptions.InvalidCredentials

The certificate files that you provided were invalid

Other notable exceptions are:

class smok.exceptions.InstanceNotReady

Some operation must be done before you can call that method

class smok.exceptions.ResponseError(status_code: Optional[int] = 599, status: str = '')

Server replied with a wrong code or didn’t reply at all.

class smok.exceptions.OperationFailedError(reason: smok.exceptions.OperationFailedReason = OperationFailedReason.TIMEOUT, timestamp: Optional[Union[int, float]] = None)

Raised by the pathpoint’s on_read and on_write futures when the operation fails

Variables
  • reason – reason of failure, or None if just not readed

  • timestamp – timestamp of failure in milliseconds

class smok.exceptions.OperationFailedReason(value)

An enumeration.

INVALID = 'invalid'

The device responded OK, but told us that this pathpoint is bogus

MALFORMED = 'malformed'

The device responded with a malformed protocol frame

TIMEOUT = 'timeout'

The device did not respond within given time

TYPE = 'type'

There was an error with the typing of the value

class smok.exceptions.NotReadedError(timestamp: Optional[float] = None)

The value is not available, due to it having not been yet read.

Note that this is invalid to return in read handling futures!

Variables

timestamp – timestamp of failure in milliseconds

NGTT exceptions

NGTT module also defines some exceptions:

class ngtt.exceptions.NGTTError

Base class for NGTT exceptions

class ngtt.exceptions.ConnectionFailed(is_due_to_no_internet: bool = False, *args)

The request failed due to a problem with connection

Variables

is_due_to_no_internet – was this error caused by the internet not being there?

class ngtt.exceptions.DataStreamSyncFailed

Server declined to sync data, as it’s invalid.

class ngtt.exceptions.InvalidFrame

An invalid frame has been sent over the wire

However, most probably you won’t have to deal with them directly.