verbessertes Fehlerhandling
This commit is contained in:
parent
4943bccb3e
commit
fdbc32bed9
|
|
@ -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'}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue