From 0987d9e662ed911c3b39b30226d2385fd32f6e26 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Thu, 18 Jul 2024 11:38:26 -0500 Subject: [PATCH] - Error handling message will now only print if an error is generated and handled --- pylot/plugins/cumulus_api/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pylot/plugins/cumulus_api/main.py b/pylot/plugins/cumulus_api/main.py index a5fa262..191db1e 100644 --- a/pylot/plugins/cumulus_api/main.py +++ b/pylot/plugins/cumulus_api/main.py @@ -148,8 +148,9 @@ def main(action, target, output=None, **kwargs): def error_handling(results, api_function, **kwargs): ret = '' if results.get('error', '') == 'Bad Request': - if 'Member must have length less than or equal to 8192' in results.get('message', ''): - print('Handling 8192 character limit error...') + error_message = results.get('message', '') + if 'Member must have length less than or equal to 8192' in error_message: + print(f'Handling error: {error_message}') cli = boto3.client('s3') stack_prefix = os.getenv('STACK_PREFIX') if not stack_prefix: @@ -207,5 +208,4 @@ def error_handling(results, api_function, **kwargs): ec.put_targets(Rule=rule_name, Targets=res.get('Targets')) else: ret = results - print('Error handling complete') return ret