mirror of
https://github.com/veops/cmdb.git
synced 2025-08-08 20:07:16 +08:00
v1 vsersion
This commit is contained in:
17
lib/exception.py
Normal file
17
lib/exception.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
|
||||
class InvalidUsageError(Exception):
|
||||
status_code = 400
|
||||
|
||||
def __init__(self, message, status_code=None, payload=None):
|
||||
Exception.__init__(self)
|
||||
self.message = message
|
||||
if status_code is not None:
|
||||
self.status_code = status_code
|
||||
self.payload = payload
|
||||
|
||||
def to_dict(self):
|
||||
rv = dict(self.payload or ())
|
||||
rv['message'] = self.message
|
||||
return rv
|
Reference in New Issue
Block a user