Skip to content
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

feature: be able to disable lambda_unhandled_exception_warning_message #140

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions awslambdaric/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

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


def _get_handler(handler):
try:
(modname, fname) = handler.rsplit(".", 1)
Expand Down Expand Up @@ -212,9 +212,11 @@ def handle_event_request(
)

if error_result is not None:
from .lambda_literals import lambda_unhandled_exception_warning_message
if not _AWS_LAMBDA_EXCEPTION_WARNING_DISABLE:
from .lambda_literals import lambda_unhandled_exception_warning_message

log_sink.log(lambda_unhandled_exception_warning_message, _WARNING_FRAME_TYPE)

log_sink.log(lambda_unhandled_exception_warning_message, _WARNING_FRAME_TYPE)
log_error(error_result, log_sink)
lambda_runtime_client.post_invocation_error(
invoke_id, to_json(error_result), to_json(xray_fault)
Expand Down