UNPKG

@rudderstack/workflow-engine

Version:
34 lines 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrorUtils = void 0; const step_execution_1 = require("./step_execution"); const workflow_execution_1 = require("./workflow_execution"); class ErrorUtils { static isAssertError(error) { return error.token === 'assert'; } static getErrorStatus(error) { return error?.response?.status ?? error?.status ?? 500; } static createStepExecutionError(error, stepName, childStepName) { return new step_execution_1.StepExecutionError(error.message, ErrorUtils.getErrorStatus(error), { stepName, childStepName, error, }); } static createWorkflowExecutionError(error, workflowName) { if (error instanceof step_execution_1.StepExecutionError) { return new workflow_execution_1.WorkflowExecutionError(error.message, ErrorUtils.getErrorStatus(error), workflowName, { stepName: error.stepName, childStepName: error.childStepName, error: error.error, }); } return new workflow_execution_1.WorkflowExecutionError(error.message, ErrorUtils.getErrorStatus(error), workflowName, { error, }); } } exports.ErrorUtils = ErrorUtils; //# sourceMappingURL=utils.js.map