refactor: Check http error for actions
This commit is contained in:
@@ -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);
|
||||||
|
Reference in New Issue
Block a user