Skip to content

ketek_error

borealis.detector.ketek_error

Created on Fri Apr 29 14:15:23 2022.

Ketek error handling. From https://gitlab.esrf.fr/bliss/python-handel/

@author: A. Vancraeyenest

HandelError(errno, strerror, description='')

Bases: IOError

Handel related error class.

Source code in borealis/detector/ketek_error.py
229
230
231
232
233
def __init__(self, errno: int, strerror: str, description: str = ''):
    self.errno = errno
    self.strerror = strerror
    self.description = description
    self.args = errno, strerror, description

from_errno(errno) classmethod

Create HandelError from error numero.

Source code in borealis/detector/ketek_error.py
238
239
240
241
242
@classmethod
def from_errno(cls, errno: int):
    """Create HandelError from error numero."""
    strerror, description = ERROR_DICT.get(errno, DEFAULT_ERROR)
    return cls(errno, strerror, description)

check_error(errno)

Check return error code and raise corresponding error if needed.

Source code in borealis/detector/ketek_error.py
245
246
247
248
def check_error(errno: int):
    """Check return error code and raise corresponding error if needed."""
    if errno != 0:
        raise HandelError.from_errno(errno)