From 5b97aaba1cb0f44666ddc85b598391c2ecc0afb2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 10 Feb 2022 12:07:37 +0000 Subject: [PATCH 1/2] Adding exception message to return to CFN --- src/cloudformation_cli_python_lib/resource.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cloudformation_cli_python_lib/resource.py b/src/cloudformation_cli_python_lib/resource.py index ace31161..111f6ad7 100644 --- a/src/cloudformation_cli_python_lib/resource.py +++ b/src/cloudformation_cli_python_lib/resource.py @@ -222,10 +222,16 @@ def print_or_log(message: str) -> None: progress = e.to_progress_event() except Exception as e: # pylint: disable=broad-except print_or_log("Exception caught {0}".format(e)) - progress = ProgressEvent.failed(HandlerErrorCode.InternalFailure) + progress = ProgressEvent.failed( + HandlerErrorCode.InternalFailure, + message=str("Exception caught {0}".format(e)), + ) except BaseException as e: # pylint: disable=broad-except print_or_log("Base exception caught (this is usually bad) {0}".format(e)) - progress = ProgressEvent.failed(HandlerErrorCode.InternalFailure) + progress = ProgressEvent.failed( + HandlerErrorCode.InternalFailure, + message=str("Base exception caught {0}".format(e)), + ) if progress.result: progress.result = None From 2c599023ad851b483ec46d6715a2f3ea5a6f1302 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 3 Apr 2022 13:46:57 +0100 Subject: [PATCH 2/2] Updating pre-commit hooks --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9544cff2..e15cbbc5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,12 +2,12 @@ exclude: ^(buildspec.yml|.pre-commit-config.yaml)$ fail_fast: true repos: - repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.17 + rev: v5.10.1 hooks: - id: isort # language_version: python3.6 - repo: https://github.com/ambv/black - rev: 20.8b1 + rev: 22.3.0 hooks: - id: black exclude: templates/ @@ -38,18 +38,18 @@ repos: - id: check-merge-conflict - id: check-yaml - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.3.0 + rev: v1.9.0 hooks: - id: python-check-blanket-noqa - id: python-check-mock-methods - id: python-no-log-warn - repo: https://github.com/PyCQA/bandit - rev: "1.6.2" + rev: "1.7.4" hooks: - id: bandit files: ^(src|python)/ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.790 + rev: v0.942 hooks: - id: mypy files: ^src/