Skip to content

Adding exception message to return to CFN #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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/
Expand Down
10 changes: 8 additions & 2 deletions src/cloudformation_cli_python_lib/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down