addons14/base_rest/http.py
def _handle_exception(self, exception):
        """Called within an except block to allow converting exceptions
        to abitrary responses. Anything returned (except None) will
        be used as response."""
        if isinstance(exception, SessionExpiredException):
            # we don't want to return the login form as plain html page
            # we want to raise a proper exception
            return wrapJsonException(Unauthorized(ustr(exception)))
        try:
            return super(HttpRestRequest, self)._handle_exception(exception)
        except MissingError as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(NotFound(ustr(e)), extra_info=extra_info)
        except (AccessError, AccessDenied) as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(Forbidden(ustr(e)), extra_info=extra_info)
        except (UserError, ValidationError) as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(
                BadRequest(e.args[0]), include_description=True, extra_info=extra_info
            )
        except HTTPException as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(e, extra_info=extra_info)
        except Exception as e:  # flake8: noqa: E722
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(InternalServerError(e), extra_info=extra_info)
Called within an except block to allow converting exceptions
        to abitrary responses. Anything returned (except None) will
        be used as response.
Called within an except block to allow converting exceptions
to abitrary responses. Anything returned (except None) will
be used as response.
Called within an except block to allow converting exceptions to abitrary responses . Anything returned ( except None ) will be used as response .
def _handle_exception(self, exception):
        if isinstance(exception, SessionExpiredException):
            return wrapJsonException(Unauthorized(ustr(exception)))
        try:
            return super(HttpRestRequest, self)._handle_exception(exception)
        except MissingError as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(NotFound(ustr(e)), extra_info=extra_info)
        except (AccessError, AccessDenied) as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(Forbidden(ustr(e)), extra_info=extra_info)
        except (UserError, ValidationError) as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(
                BadRequest(e.args[0]), include_description=True, extra_info=extra_info
            )
        except HTTPException as e:
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(e, extra_info=extra_info)
        except Exception as e:  
            extra_info = getattr(e, "rest_json_info", None)
            return wrapJsonException(InternalServerError(e), extra_info=extra_info)
def _handle_exception ( self , exception ) : if isinstance ( exception , SessionExpiredException ) : return wrapJsonException ( Unauthorized ( ustr ( exception ) ) ) try : return super ( HttpRestRequest , self ) . _handle_exception ( exception ) except MissingError as e : extra_info = getattr ( e , "rest_json_info" , None ) return wrapJsonException ( NotFound ( ustr ( e ) ) , extra_info = extra_info ) except ( AccessError , AccessDenied ) as e : extra_info = getattr ( e , "rest_json_info" , None ) return wrapJsonException ( Forbidden ( ustr ( e ) ) , extra_info = extra_info ) except ( UserError , ValidationError ) as e : extra_info = getattr ( e , "rest_json_info" , None ) return wrapJsonException ( BadRequest ( e . args [ 0 ] ) , include_description = True , extra_info = extra_info ) except HTTPException as e : extra_info = getattr ( e , "rest_json_info" , None ) return wrapJsonException ( e , extra_info = extra_info ) except Exception as e : extra_info = getattr ( e , "rest_json_info" , None ) return wrapJsonException ( InternalServerError ( e ) , extra_info = extra_info )
Called within an except block to allow converting exceptions
to abitrary responses.
Called within an except block to allow converting exceptions to abitrary responses .
"""Called within an except block to allow converting exceptions
        to abitrary responses. Anything returned (except None) will
        be used as response.""" # we don't want to return the login form as plain html page # we want to raise a proper exception # flake8: noqa: E722
self
exception