Skip to content

Commit 11a8e79

Browse files
committed
feature: be able to disable lambda_unhandled_exception_warning_message
1 parent 03ba270 commit 11a8e79

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

awslambdaric/bootstrap.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828
ERROR_LOG_LINE_TERMINATE = "\r"
2929
ERROR_LOG_IDENT = "\u00a0" # NO-BREAK SPACE U+00A0
30+
_AWS_LAMBDA_EXCEPTION_WARNING_DISABLE = bool(os.environ.get("AWS_LAMBDA_EXCEPTION_WARNING_DISABLE"))
3031
_AWS_LAMBDA_LOG_FORMAT = LogFormat.from_str(os.environ.get("AWS_LAMBDA_LOG_FORMAT"))
3132
_AWS_LAMBDA_LOG_LEVEL = _get_log_level_from_env_var(
3233
os.environ.get("AWS_LAMBDA_LOG_LEVEL")
3334
)
3435

35-
3636
def _get_handler(handler):
3737
try:
3838
(modname, fname) = handler.rsplit(".", 1)
@@ -212,9 +212,11 @@ def handle_event_request(
212212
)
213213

214214
if error_result is not None:
215-
from .lambda_literals import lambda_unhandled_exception_warning_message
215+
if not _AWS_LAMBDA_EXCEPTION_WARNING_DISABLE:
216+
from .lambda_literals import lambda_unhandled_exception_warning_message
217+
218+
log_sink.log(lambda_unhandled_exception_warning_message, _WARNING_FRAME_TYPE)
216219

217-
log_sink.log(lambda_unhandled_exception_warning_message, _WARNING_FRAME_TYPE)
218220
log_error(error_result, log_sink)
219221
lambda_runtime_client.post_invocation_error(
220222
invoke_id, to_json(error_result), to_json(xray_fault)

0 commit comments

Comments
 (0)