jumpserver/apps/common/sdk/gm/piico/exception.py

13 lines
345 B
Python
Raw Normal View History

2022-08-23 09:40:01 +00:00
class PiicoError(Exception):
def __init__(self, msg, ret):
super().__init__(self)
self.__ret = ret
self.__msg = msg
def __str__(self):
return "piico error: {} return code: {}".format(self.__msg, self.hex_ret(self.__ret))
@staticmethod
def hex_ret(ret):
return hex(ret & ((1 << 32) - 1))