def create_error_response(self):
     exception_msg = traceback.format_exc()
     get_logger().error("Exception launched:\n %s", exception_msg)
     return {
         "statusCode": 500,
         "headers": {
             "amz-lambda-request-id": self.lambda_instance.get_request_id(),
             "amz-log-group-name": self.lambda_instance.get_log_group_name(),
             "amz-log-stream-name": self.lambda_instance.get_log_stream_name()
         },
         "body": StrUtils.dict_to_base64str({"exception" : exception_msg}),
         "isBase64Encoded": True,
     }
Exemple #2
0
 def test_dict_to_base64str(self):
     self.assertEqual(StrUtils.dict_to_base64str({
         "k1": "v1",
         "k2": "v2"
     }), "eyJrMSI6ICJ2MSIsICJrMiI6ICJ2MiJ9")