Handle the given exception. Log, sets the response code and
        output the exception message as an error message.

        :param e: Exception which is being handled.
        :type e: :class:`Exception`
        :param status: Status code to set.
        :type status: int

def handle_exception(self, e, status=500):
        """Handle the given exception. Log, sets the response code and
        output the exception message as an error message.

        :param e: Exception which is being handled.
        :type e: :class:`Exception`
        :param status: Status code to set.
        :type status: int
        """
        logger.exception(
            "An exception occurred while handling the request: %s", e)
        self.response.body_raw = {'error': str(e)}
        self.response.status = status