diff --git a/gnocpush/gateway.py b/gnocpush/gateway.py index 0c2987b..65d87a0 100644 --- a/gnocpush/gateway.py +++ b/gnocpush/gateway.py @@ -5,7 +5,7 @@ import os import sys -from flask import Flask, request +from flask import Flask, request, jsonify from gnocpush import Pusher from prometheus_flask_exporter import PrometheusMetrics @@ -23,7 +23,13 @@ def push_endpoint(): log.debug(f"Received data: {json.dumps(data)}") - yeeter.push(data['alerts']) + try: + yeeter.push(data['alerts']) + # XXX testing + raise Exception("This is a test exception") + except Exception as e: + log.error(f"Failed to push alerts to GNOC: {str(e)}") + return jsonify(error=str(e)), 502 # Return a response return {'status': 'success'}