def handle_error(self, e):
got_request_exception.send(current_app._get_current_object(), exception=e)<EOL>if not isinstance(e, HTTPException) and current_app.propagate_exceptions:<EOL><INDENT>exc_type, exc_value, tb = sys.exc_info()<EOL>if exc_value is e:<EOL><INDENT>raise<EOL><DEDENT>else:<EOL><INDENT>raise e<EOL><DEDENT><DEDENT>headers = Headers()<EOL>if isinstance(e, HTTPException):<EOL><INDENT>code = e.code<EOL>default_data = {<EOL>'<STR_LIT:message>': getattr(e, '<STR_LIT:description>', http_status_message(code))<EOL>}<EOL>headers = e.get_response().headers<EOL><DEDENT>else:<EOL><INDENT>code = <NUM_LIT><EOL>default_data = {<EOL>'<STR_LIT:message>': http_status_message(code),<EOL>}<EOL><DEDENT>remove_headers = ('<STR_LIT>',)<EOL>for header in remove_headers:<EOL><INDENT>headers.pop(header, None)<EOL><DEDENT>data = getattr(e, '<STR_LIT:data>', default_data)<EOL>if code and code >= <NUM_LIT>:<EOL><INDENT>exc_info = sys.exc_info()<EOL>if exc_info[<NUM_LIT:1>] is None:<EOL><INDENT>exc_info = None<EOL><DEDENT>current_app.log_exception(exc_info)<EOL><DEDENT>error_cls_name = type(e).__name__<EOL>if error_cls_name in self.errors:<EOL><INDENT>custom_data = self.errors.get(error_cls_name, {})<EOL>code = custom_data.get('<STR_LIT:status>', <NUM_LIT>)<EOL>data.update(custom_data)<EOL><DEDENT>if code == <NUM_LIT> and self.default_mediatype is None:<EOL><INDENT>supported_mediatypes = list(self.representations.keys())<EOL>fallback_mediatype = supported_mediatypes[<NUM_LIT:0>] if supported_mediatypes else "<STR_LIT>"<EOL>resp = self.make_response(<EOL>data,<EOL>code,<EOL>headers,<EOL>fallback_mediatype = fallback_mediatype<EOL>)<EOL><DEDENT>else:<EOL><INDENT>resp = self.make_response(data, code, headers)<EOL><DEDENT>if code == <NUM_LIT>:<EOL><INDENT>resp = self.unauthorized(resp)<EOL><DEDENT>return resp<EOL>
Error handler for the API transforms a raised exception into a Flask
        response, with the appropriate HTTP status code and body.

        :param e: the raised Exception object
        :type e: Exception