diff --git a/gnocpush/gateway.py b/gnocpush/gateway.py index 0c2987b..f63dee4 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,11 @@ def push_endpoint(): log.debug(f"Received data: {json.dumps(data)}") - yeeter.push(data['alerts']) + try: + yeeter.push(data['alerts']) + except Exception as e: + log.error("Failed to push alerts to GNOC") + return jsonify(error=str(e)), 502 # Return a response return {'status': 'success'}