Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-commons
Commits
7fc2b83f
Commit
7fc2b83f
authored
Apr 15, 2021
by
Wei Shoulin
Browse files
error
parent
f482a53e
Changes
2
Hide whitespace changes
Inline
Side-by-side
csst_dfs_commons/models/__init__.py
View file @
7fc2b83f
...
...
@@ -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
csst_dfs_commons/models/errors.py
0 → 100644
View file @
7fc2b83f
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment