export async function getCodeForFailedResult()

in src/common/shared.ts [103:121]


export async function getCodeForFailedResult(
  electronAPI: IElectronAPI,
  steps: Steps,
  journey?: Journey
): Promise<string> {
  if (!journey) return '';

  const failedJourneyStep = journey.steps.find(({ status }) => status === 'failed');

  if (!failedJourneyStep) return '';

  const failedStep = steps.find(
    step => step.actions.length > 0 && step.actions[0].title === failedJourneyStep.name
  );

  if (!failedStep) return '';

  return getCodeFromActions(electronAPI, [failedStep], journey.type);
}