20
20
from awslambdaric .lambda_runtime_exception import FaultException
21
21
from awslambdaric .lambda_runtime_log_utils import LogFormat , _get_log_level_from_env_var
22
22
from awslambdaric .lambda_runtime_marshaller import LambdaMarshaller
23
+ from awslambdaric .lambda_literals import (
24
+ lambda_unhandled_exception_warning_message ,
25
+ )
23
26
24
27
25
28
class TestUpdateXrayEnv (unittest .TestCase ):
@@ -461,7 +464,10 @@ def raise_exception_handler(json_input, lambda_context):
461
464
)
462
465
463
466
# NOTE: Indentation characters are NO-BREAK SPACE (U+00A0) not SPACE (U+0020)
464
- error_logs = "[ERROR] FaultExceptionType: Fault exception msg\r "
467
+ error_logs = (
468
+ lambda_unhandled_exception_warning_message
469
+ + "[ERROR] FaultExceptionType: Fault exception msg\r "
470
+ )
465
471
error_logs += "Traceback (most recent call last):\r "
466
472
error_logs += ' File "spam.py", line 3, in <module>\r '
467
473
error_logs += " spam.eggs()\r "
@@ -492,7 +498,10 @@ def raise_exception_handler(json_input, lambda_context):
492
498
0 ,
493
499
bootstrap .StandardLogSink (),
494
500
)
495
- error_logs = "[ERROR] FaultExceptionType: Fault exception msg\r Traceback (most recent call last):\n "
501
+ error_logs = (
502
+ lambda_unhandled_exception_warning_message
503
+ + "[ERROR] FaultExceptionType: Fault exception msg\r Traceback (most recent call last):\n "
504
+ )
496
505
497
506
self .assertEqual (mock_stdout .getvalue (), error_logs )
498
507
@@ -518,7 +527,10 @@ def raise_exception_handler(json_input, lambda_context):
518
527
0 ,
519
528
bootstrap .StandardLogSink (),
520
529
)
521
- error_logs = "[ERROR] FaultExceptionType\r Traceback (most recent call last):\n "
530
+ error_logs = (
531
+ lambda_unhandled_exception_warning_message
532
+ + "[ERROR] FaultExceptionType\r Traceback (most recent call last):\n "
533
+ )
522
534
523
535
self .assertEqual (mock_stdout .getvalue (), error_logs )
524
536
@@ -544,7 +556,10 @@ def raise_exception_handler(json_input, lambda_context):
544
556
0 ,
545
557
bootstrap .StandardLogSink (),
546
558
)
547
- error_logs = "[ERROR] Fault exception msg\r Traceback (most recent call last):\n "
559
+ error_logs = (
560
+ lambda_unhandled_exception_warning_message
561
+ + "[ERROR] Fault exception msg\r Traceback (most recent call last):\n "
562
+ )
548
563
549
564
self .assertEqual (mock_stdout .getvalue (), error_logs )
550
565
@@ -579,8 +594,7 @@ def raise_exception_handler(json_input, lambda_context):
579
594
0 ,
580
595
bootstrap .StandardLogSink (),
581
596
)
582
-
583
- error_logs = "[ERROR]\r "
597
+ error_logs = lambda_unhandled_exception_warning_message + "[ERROR]\r "
584
598
error_logs += "Traceback (most recent call last):\r "
585
599
error_logs += ' File "spam.py", line 3, in <module>\r '
586
600
error_logs += " spam.eggs()\r "
@@ -615,8 +629,10 @@ def test_handle_event_request_fault_exception_logging_syntax_error(
615
629
0 ,
616
630
bootstrap .StandardLogSink (),
617
631
)
618
-
619
- error_logs = f"[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'a': { syntax_error } \r "
632
+ error_logs = (
633
+ lambda_unhandled_exception_warning_message
634
+ + f"[ERROR] Runtime.UserCodeSyntaxError: Syntax error in module 'a': { syntax_error } \r "
635
+ )
620
636
error_logs += "Traceback (most recent call last):\r "
621
637
error_logs += ' File "<string>" Line 1\r '
622
638
error_logs += " -\n "
0 commit comments