Commit 7fc2b83f authored by Wei Shoulin's avatar Wei Shoulin
Browse files

error

parent f482a53e
......@@ -2,28 +2,38 @@
class Result(dict):
def __init__(self):
super(Result, self).__init__()
self.code = 0
self.message = ""
self.data = None
self["code"] = 0
self["message"] = ""
self["data"] = None
def success(self):
return self.code >= 0
return self["code"] >= 0
def data(self):
return self["data"]
def message(self):
return self["message"]
@staticmethod
def error(code = -1, message = ""):
r = Result()
r.code = code
r.message = message
r["code"] = code
r["message"] = message
return r
@staticmethod
def ok_data(data):
r = Result()
r.data = data
r["data"] = data
return r
@staticmethod
def ok_msg(message):
r = Result()
r.message = message
return r
\ No newline at end of file
r["message"] = message
return r
def append(self, k: str, v):
self[k] = v
return self
\ No newline at end of file
class CSSTGenericException(Exception):
def __init__(self, *args) -> None:
super(CSSTGenericException, self).__init__(*args)
class CSSTFatalException(Exception):
def __init__(self, *args) -> None:
super(CSSTFatalException, self).__init__(*args)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment