<s> """<STR_LIT>""" <EOL> import falcon <EOL> import logging <EOL> from freezer_api . common . _i18n import _ <EOL> class FreezerAPIException ( falcon . HTTPError ) : <EOL> """<STR_LIT>""" <EOL> message = "<STR_LIT>" <EOL> def __init__ ( self , message = '<STR_LIT>' ) : <EOL> if message : <EOL> self . message = _ ( str ( message ) ) <EOL> logging . error ( message ) <EOL> Exception . __init__ ( self , message ) <EOL> @ staticmethod <EOL> def handle ( ex , req , resp , params ) : <EOL> raise falcon . HTTPError ( _ ( '<STR_LIT>' ) , <EOL> title = _ ( "<STR_LIT>" ) , <EOL> description = FreezerAPIException . message ) <EOL> class BadDataFormat ( FreezerAPIException ) : <EOL> @ staticmethod <EOL> def handle ( ex , req , resp , params ) : <EOL> raise falcon . HTTPBadRequest ( <EOL> title = _ ( "<STR_LIT>" ) , <EOL> description = ex . message ) <EOL> class DocumentExists ( FreezerAPIException ) : <EOL> @ staticmethod <EOL> def handle ( ex , req , resp , params ) : <EOL> raise falcon . HTTPConflict ( <EOL> title = _ ( "<STR_LIT>" ) , <EOL> description = ex . message ) <EOL> class StorageEngineError ( FreezerAPIException ) : <EOL> @ staticmethod <EOL> def handle ( ex , req , resp , params ) : <EOL> raise falcon . HTTPInternalServerError ( <EOL> title = _ ( "<STR_LIT>" ) , <EOL> description = ex . message ) <EOL> class DocumentNotFound ( FreezerAPIException ) : <EOL> @ staticmethod <EOL> def handle ( ex , req , resp , params ) : <EOL> raise falcon . HTTPError ( <EOL> status = falcon . status . HTTP_404 , <EOL> title = _ ( "<STR_LIT>" ) , <EOL> description = ex . message ) <EOL> class AccessForbidden ( FreezerAPIException ) : <EOL> @ staticmethod <EOL> def handle ( ex , req , resp , params ) : <EOL> raise falcon . HTTPForbidden ( <EOL> title = _ ( "<STR_LIT>" ) , <EOL> description = ex . message ) <EOL> class MethodNotImplemented ( FreezerAPIException ) : <EOL> @ staticmethod <EOL> def handle ( ex , req , resp , params ) : <EOL> raise falcon . HTTPMethodNotAllowed ( <EOL> title = _ ( "<STR_LIT>" ) , <EOL> description = ex . message , <EOL> allowed_methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> exception_handlers_catalog = [ <EOL> BadDataFormat , <EOL> DocumentExists , <EOL> StorageEngineError , <EOL> DocumentNotFound , <EOL> AccessForbidden , <EOL> MethodNotImplemented <EOL> ] </s>
