add some decent error messages

This commit is contained in:
Michaela 2021-08-20 18:48:41 +10:00
parent 090bc92edb
commit 702e3bb240

View File

@ -326,7 +326,12 @@ def upload(event, context):
post(to_sns)
return errors
def lambda_handler(event, context):
errors = upload(event, context)
try:
errors = upload(event, context)
except zlib.error:
return {"statusCode": 400, "body": "Could not decompress"}
except json.decoder.JSONDecodeError:
return {"statusCode": 400, "body": "Not valid json"}
error_message = {
"message": "some or all payloads could not be processed",
"errors": errors