28 lines
890 B
Python
28 lines
890 B
Python
# uncompyle6 version 3.9.2
|
|
# Python bytecode version base 3.7.0 (3394)
|
|
# Decompiled from: Python 3.8.19 (default, Mar 20 2024, 15:27:52)
|
|
# [Clang 14.0.6 ]
|
|
# Embedded file name: /var/user/app/device_supervisorbak/device_supervisor/lib/mcprotocol/mcerror.py
|
|
# Compiled at: 2024-04-18 03:12:58
|
|
# Size of source mod 2**32: 585 bytes
|
|
"""This file is collection of mcprotocol error.
|
|
"""
|
|
|
|
class MCProtocolError(Exception):
|
|
__doc__ = "devicecode error. Device is not exsist.\n "
|
|
|
|
def __init__(self, errorcode):
|
|
self.errorcode = "0x" + format(errorcode, "x").rjust(4, "0").upper()
|
|
|
|
def __str__(self):
|
|
return "mc protocol error: error code {}".format(self.errorcode)
|
|
|
|
|
|
def check_mcprotocol_error(status):
|
|
"""Check mc protocol command error.
|
|
If errot exist(status != 0), raise Error.
|
|
"""
|
|
if status == 0:
|
|
return
|
|
raise MCProtocolError(status)
|