2015-06-22 13:47:27 -07:00
|
|
|
"""
|
|
|
|
.. module: lemur.exceptions
|
2018-05-29 10:18:16 -07:00
|
|
|
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
|
2015-06-22 13:47:27 -07:00
|
|
|
:license: Apache, see LICENSE for more details.
|
|
|
|
"""
|
|
|
|
from flask import current_app
|
|
|
|
|
|
|
|
|
|
|
|
class LemurException(Exception):
|
2016-11-29 10:02:40 -08:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
current_app.logger.exception(self)
|
2015-06-22 13:47:27 -07:00
|
|
|
|
|
|
|
|
2015-06-24 16:48:40 -07: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 13:47:27 -07:00
|
|
|
class InvalidListener(LemurException):
|
|
|
|
def __str__(self):
|
2019-05-16 07:57:02 -07:00
|
|
|
return repr(
|
|
|
|
"Invalid listener, ensure you select a certificate if you are using a secure protocol"
|
|
|
|
)
|
2015-06-22 13:47:27 -07:00
|
|
|
|
|
|
|
|
|
|
|
class AttrNotFound(LemurException):
|
|
|
|
def __init__(self, field):
|
|
|
|
self.field = field
|
|
|
|
|
|
|
|
def __str__(self):
|
2017-08-16 19:38:42 +03:00
|
|
|
return repr("The field '{0}' is not sortable or filterable".format(self.field))
|
2015-06-22 13:47:27 -07:00
|
|
|
|
|
|
|
|
2016-11-29 10:02:40 -08:00
|
|
|
class InvalidConfiguration(Exception):
|
|
|
|
pass
|
2018-05-04 15:00:43 -07:00
|
|
|
|
|
|
|
|
|
|
|
class InvalidAuthority(Exception):
|
|
|
|
pass
|
2018-05-08 11:03:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
class UnknownProvider(Exception):
|
|
|
|
pass
|