Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/client/src/sagas/ActionExecution/PluginActionSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,15 @@ export default function* executePluginActionTriggerSaga(
} else {
throw new PluginTriggerFailureError(
createMessage(ERROR_PLUGIN_ACTION_EXECUTE, pluginActionNameToDisplay),
[],
[
payload.body,
params,
{
isExecutionSuccess: payload.isExecutionSuccess,
statusCode: payload.statusCode,
headers: payload.headers,
},
],
);
}
} else {
Expand Down
11 changes: 9 additions & 2 deletions app/client/src/sagas/EvaluationsSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,15 @@ export function* executeTriggerRequestSaga(
// a success: false is sent to reject the promise
// @ts-expect-error: reason is of type string
responsePayload.error = {
// @ts-expect-error: reason is of type string
message: error.responseData?.[0] || error.message,
message:
// @ts-expect-error: reason is of type string
error.responseData?.[0] && typeof error.responseData?.[0] === "string"
? // @ts-expect-error: reason is of type string
error.responseData?.[0]
: // @ts-expect-error: reason is of type string
error.message,
// @ts-expect-error: responseData is of type array
responseData: error.responseData || [],
};
}

Expand Down
23 changes: 22 additions & 1 deletion app/client/src/workers/Evaluation/fns/actionFns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@ export default async function run(
* */
return response[0];
} catch (e) {
const error = {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
message: (e as any).message,
};

// If error contains responseData, update action data and responseMeta before throwing
// @ts-expect-error: responseData is a custom property
if (e.responseData && e.responseData.length > 0) {
// @ts-expect-error: self type is not defined
const action = self[this.name] as ActionEntity;
// @ts-expect-error: responseData is array format
const responseData = e.responseData;

if (action && responseData.length >= 3) {
action.data = responseData[0]; // error response body
action.responseMeta = responseData[2]; // { isExecutionSuccess, statusCode, headers }
Comment thread
rahulbarwal marked this conversation as resolved.
action.isLoading = false;
}
}

if (typeof onError === "function") {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -76,7 +97,7 @@ export default async function run(
return;
}

throw e;
throw error;
}
}

Expand Down
Loading