verbessertes Fehlerhandling

This commit is contained in:
Andreas Knuth 2025-06-14 20:22:34 -05:00
parent 4943bccb3e
commit fdbc32bed9
1 changed files with 13 additions and 7 deletions

View File

@ -94,10 +94,16 @@ def lambda_handler(event, context):
} }
# Single API call # Single API call
if call_api_once(payload, payload['domain'], req_id): try:
# Metadaten setzen Mail bleibt in S3 success = call_api_once(payload, payload['domain'], req_id)
except Exception as e:
logger.error(f"API-Call-Exception: {e}")
success = False
# Egal ob success True oder False: wir geben 200 zurück
if success:
try:
mark_email_processed(bucket, key, s3_client) mark_email_processed(bucket, key, s3_client)
return {'statusCode': 200, 'body': 'Processed'} except Exception as e:
else: logger.error(f"Markieren fehlgeschlagen: {e}")
logger.error(f"[{req_id}] API call failed, leaving object unmodified") return {'statusCode': 200, 'body': 'Done'}
return {'statusCode': 500, 'body': 'API Error'}