2020-12-21 21:08:01 -05:00
|
|
|
"""Application exceptions
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2021-10-28 23:17:00 -04:00
|
|
|
KodakException
|
2020-12-21 21:08:01 -05:00
|
|
|
+-- ClientError
|
|
|
|
+-- ServerError
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2021-10-28 23:17:00 -04:00
|
|
|
class KodakException(Exception):
|
2020-12-21 21:08:01 -05:00
|
|
|
"""Whomp whomp, something went wrong
|
|
|
|
|
|
|
|
But seriously, don't ever raise this exception
|
|
|
|
"""
|
|
|
|
|
|
|
|
status: int
|
|
|
|
|
|
|
|
|
2021-10-28 23:17:00 -04:00
|
|
|
class ClientError(KodakException):
|
2020-12-21 21:08:01 -05:00
|
|
|
"""Error while processing client side input"""
|
|
|
|
|
|
|
|
status = 400
|
|
|
|
|
|
|
|
|
|
|
|
class ImageResourceDeletedError(ClientError):
|
|
|
|
"""Requested image resource has been deleted"""
|
|
|
|
|
|
|
|
status = 410
|
|
|
|
|
|
|
|
|
2021-10-30 11:51:41 -04:00
|
|
|
class IAmATeapotError(ClientError):
|
|
|
|
"""User tried to brew coffee, but application is a teapot"""
|
|
|
|
|
|
|
|
status = 418
|
|
|
|
|
|
|
|
|
2021-10-28 23:17:00 -04:00
|
|
|
class ServerError(KodakException):
|
2020-12-21 21:08:01 -05:00
|
|
|
"""Error while processing server side data"""
|
|
|
|
|
|
|
|
status = 500
|
|
|
|
|
|
|
|
|
|
|
|
class ImageFileRemovedError(ServerError):
|
|
|
|
"""Image file removed from server"""
|
2021-10-29 01:32:04 -04:00
|
|
|
|
|
|
|
|
|
|
|
class ConfigurationError(ServerError):
|
|
|
|
"""Failed to load the application configuration"""
|