def lambda_handler()

in errorLaunchingSimulations/app.py [0:0]


def lambda_handler(event, context):
    '''
    This lambda function catches any errors in the simulation launching and monitoring workflow. If it fails, we return a fail to CodePipeline with a message that summarizes the error.
    {
        'codePipelineJobId': 'The CodePipeline ID',
        'error': {
                'Cause': 'The cause of the error.'
        }
    }
    '''    
    code_pipeline_response = pipeline.put_job_failure_result(jobId=event['codePipelineJobId'], failureDetails={
            'type': 'JobFailed',
            'message': event['error']['Cause']
    })
        
    return json.dumps(event['error'])