本文整理汇总了Python中exceptions.Exception类的典型用法代码示例。如果您正苦于以下问题:Python Exception类的具体用法?Python Exception怎么用?Python Exception使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Exception类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, status, msg):
supermsg = 'Memcached error #' + repr(status)
if msg:
supermsg += ": " + msg
Exception.__init__(self, supermsg)
self.status = status
self.msg = msg
示例2: __init__
def __init__(self, error, status, code=400, headers=None):
Exception.__init__(self)
if not isinstance(error, list):
self.errors = [str(error)]
else:
self.errors = error
self.code = code
self.status = status
self.headers = headers
示例3: __init__
def __init__(self, **kwargs):
"""
DBS exception can be initialized in following ways:
DBSException(args=exceptionString)
DBSException(exception=exceptionObject)
"""
args = kwargs.get("args", "")
ex = kwargs.get("exception", None)
if ex != None:
if isinstance(ex, Exception):
exArgs = "%s" % (ex)
if args == "":
args = exArgs
else:
args = "%s (%s)" % (args, exArgs)
Exception.__init__(self, args)
示例4: __init__
def __init__(self, extent):
Exception.__init__(self)
self.message = "Could not use: {0} as extent".format(extent)
示例5: __init__
def __init__(self, sofar, numpreds, succs):
Exception.__init__(self, "cycle in constraints", sofar, numpreds, succs)
self.preds = None
示例6: __init__
def __init__(self, value=None):
Exception.__init__(self)
self.value = value
示例7: __init__
def __init__(self, msg, variableValue):
Exception.__init__(self, msg)
self.variableValue = variableValue
示例8: __init__
def __init__(self, message):
""" Initialize module """
Exception.__init__(self)
self.message = message
示例9: __init__
def __init__(self, path):
Exception.__init__(self, 'Path not found, %s', path)
示例10: __init__
def __init__(self, message):
Exception.__init__(self)
self.message = message
示例11: __init__
def __init__(self, msg):
Exception.__init__(self, msg)
示例12: __init__
def __init__(self, insee_code, year):
message = "The commune with insee code %s was removed in %s"%(insee_code, year)
Exception.__init__(self, message)
示例13: __init__
def __init__(self, message, innerException = None):
Exception.__init__(self)
self.message = message
self.innerException = innerException
示例14: __init__
def __init__(self, *args, **keywords):
Exception.__init__(self, *args)
self.keywords = keywords
self._print_exc_str = None
示例15: __init__
def __init__(self):
Exception.__init__(self)