Skip to content

Commit db9f241

Browse files
Remove stack traces when debug mode is not enabled (#92)
1 parent 11c02f6 commit db9f241

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pip install https://github.com/boto/botocore/archive/v2.zip https://github.com/a
9797

9898
## Change Log
9999

100+
* v0.22.2: Display full stack traces only in `--debug` mode; non-debug runs now show concise error messages, consistent with `awscli` behavior.
100101
* v0.22.1: Fix issue with cfn package and cfn deploy with awscli >= 1.41.9
101102
* v0.22.0: Use fallback for endpoint detection. Should prevent most cases of `Unable to find LocalStack endpoint for service ...`
102103
* v0.21.1: Introducing semantic versioning and list of services without endpoints

bin/awslocal

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import os
2121
import sys
2222
import subprocess
2323
import re
24+
import traceback
2425

2526
PARENT_FOLDER = os.path.realpath(os.path.join(os.path.dirname(__file__), '..'))
2627
S3_VIRTUAL_ENDPOINT_HOSTNAME = 's3.localhost.localstack.cloud'
@@ -41,6 +42,8 @@ def get_service():
4142
if not param.startswith('-'):
4243
return param
4344

45+
def is_debug_mode():
46+
return "--debug" in sys.argv
4447

4548
def get_service_endpoint(localstack_host=None):
4649
service = get_service()
@@ -83,7 +86,14 @@ def main():
8386
try:
8487
import awscli.clidriver # noqa: F401
8588
except Exception:
86-
return run_as_separate_process()
89+
try:
90+
return run_as_separate_process()
91+
except Exception as e:
92+
if is_debug_mode():
93+
traceback.print_exc()
94+
else:
95+
print(f"\n{e}")
96+
sys.exit(1)
8797
patch_awscli_libs()
8898
run_in_process()
8999

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
setup(
1818
name='awscli-local',
19-
version='0.22.1',
19+
version='0.22.2',
2020
description=description,
2121
long_description=README,
2222
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)