verbessertes Fehlerhandling
This commit is contained in:
parent
4943bccb3e
commit
fdbc32bed9
|
|
@ -94,10 +94,16 @@ def lambda_handler(event, context):
|
|||
}
|
||||
|
||||
# Single API call
|
||||
if call_api_once(payload, payload['domain'], req_id):
|
||||
# Metadaten setzen – Mail bleibt in S3
|
||||
try:
|
||||
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)
|
||||
return {'statusCode': 200, 'body': 'Processed'}
|
||||
else:
|
||||
logger.error(f"[{req_id}] API call failed, leaving object unmodified")
|
||||
return {'statusCode': 500, 'body': 'API Error'}
|
||||
except Exception as e:
|
||||
logger.error(f"Markieren fehlgeschlagen: {e}")
|
||||
return {'statusCode': 200, 'body': 'Done'}
|
||||
|
|
|
|||
Loading…
Reference in New Issue