Skip to content

@salesforce/b2c-tooling-sdk / operations/jobs / getJobErrorMessage

Function: getJobErrorMessage()

getJobErrorMessage(execution): string | undefined

Defined in: packages/b2c-tooling-sdk/src/operations/jobs/run.ts:279

Extracts the error message from a failed job execution.

Looks for the last step execution with exit_status code 'ERROR' and returns its message.

Parameters

execution

The job execution to extract the error message from

Returns

string | undefined

The error message if found, undefined otherwise

Example

typescript
const errorMsg = getJobErrorMessage(execution);
if (errorMsg) {
  console.error(`Job failed: ${errorMsg}`);
}

All rights reserved.