2015-06-22 22:47:27 +02:00
|
|
|
"""
|
|
|
|
.. module: lemur.exceptions
|
|
|
|
:copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
|
|
|
|
:license: Apache, see LICENSE for more details.
|
|
|
|
"""
|
|
|
|
from flask import current_app
|
|
|
|
|
|
|
|
|
|
|
|
class LemurException(Exception):
|
2016-11-29 19:02:40 +01:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
current_app.logger.exception(self)
|
2015-06-22 22:47:27 +02:00
|
|
|
|
|
|
|
|
2015-06-25 01:48:40 +02:00
|
|
|
class DuplicateError(LemurException):
|
|
|
|
def __init__(self, key):
|
|
|
|
self.key = key
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return repr("Duplicate found! Could not create: {0}".format(self.key))
|
|
|
|
|
|
|
|
|
2015-06-22 22:47:27 +02:00
|
|
|
class InvalidListener(LemurException):
|
|
|
|
def __str__(self):
|
|
|
|
return repr("Invalid listener, ensure you select a certificate if you are using a secure protocol")
|
|
|
|
|
|
|
|
|
|
|
|
class AttrNotFound(LemurException):
|
|
|
|
def __init__(self, field):
|
|
|
|
self.field = field
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return repr("The field '{0}' is not sortable".format(self.field))
|
|
|
|
|
|
|
|
|
2016-11-29 19:02:40 +01:00
|
|
|
class InvalidConfiguration(Exception):
|
|
|
|
pass
|