Skip to content

Commit

Permalink
(WIP) handle gnoc api errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt committed Apr 29, 2024
1 parent 1b97577 commit 46fda7b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gnocpush/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'}
Expand Down

0 comments on commit 46fda7b

Please sign in to comment.