refactor: Check http error for actions

This commit is contained in:
Faruk AYDIN
2022-11-11 00:38:10 +01:00
committed by Ali BARIN
parent eac3fd24a1
commit adddf23ae3

View File

@@ -4,6 +4,7 @@ import Execution from '../models/execution';
import ExecutionStep from '../models/execution-step'; import ExecutionStep from '../models/execution-step';
import computeParameters from '../helpers/compute-parameters'; import computeParameters from '../helpers/compute-parameters';
import globalVariable from '../helpers/global-variable'; import globalVariable from '../helpers/global-variable';
import HttpError from '../errors/http';
type ProcessActionOptions = { type ProcessActionOptions = {
flowId: string; flowId: string;
@@ -43,8 +44,8 @@ export const processAction = async (options: ProcessActionOptions) => {
try { try {
await actionCommand.run($); await actionCommand.run($);
} catch (error) { } catch (error) {
if (error?.response?.httpError) { if (error instanceof HttpError) {
$.actionOutput.error = error.response.httpError; $.actionOutput.error = error.details;
} else { } else {
try { try {
$.actionOutput.error = JSON.parse(error.message); $.actionOutput.error = JSON.parse(error.message);