def server_error(e):
     client = error_reporting.Client(app.config['PROJECT_ID'])
     client.report_exception(
         http_context=error_reporting.build_flask_context(request))
     return """
     An internal error occurred.
     """, 500
Beispiel #2
0
 def server_error(e):
     client = error_reporting.Client(app.config['PROJECT_ID'])
     client.report_exception(
         http_context=error_reporting.build_flask_context(request))
     return """
     An internal error occurred.
     """, 500
Beispiel #3
0
def server_error(e):
    client = error_reporting.Client()
    client.report_exception(
        http_context=error_reporting.build_flask_context(request))
    return """
    An internal error occurred: <pre>{}</pre>
    See logs for full stacktrace.
    """.format(e), 500
Beispiel #4
0
    def report(self, with_request_context=True):
        if self.disabled:
            return

        client = self._get_client()
        if with_request_context:
            client.report_exception(
                http_context=error_reporting.build_flask_context(request))
        else:
            client.report_exception()
Beispiel #5
0
def handleHttp(request: 'flask.Request') -> str:
    tracer = initialize_tracer(request)
    req = WebhookRequest()
    res = WebhookResponse()
    try:
        json_format.Parse(request.data, req, ignore_unknown_fields=True)
        if req.query_result.action == "roll":
            with tracer.span(name='roll'):
                handleRoll(req, res)
    except UnfulfillableRequestError as e:
        logging.exception(e)
        if STACKDRIVER_ERROR_REPORTING:
            try:
                client = error_reporting.Client()
                client.report_exception(
                    http_context=error_reporting.build_flask_context(request))
            except Exception:
                logging.exception("Failed to send error report to Google")
        add_fulfillment_messages(res, str(e))
    return json_format.MessageToJson(res)