fix: Mute action execution errors when error callback is present (#9366)
This commit is contained in:
parent
41c7c344b4
commit
5d7f68a031
|
|
@ -0,0 +1,65 @@
|
|||
const commonlocators = require("../../../../locators/commonlocators.json");
|
||||
const dsl = require("../../../../fixtures/buttonApiDsl.json");
|
||||
const widgetsPage = require("../../../../locators/Widgets.json");
|
||||
const publishPage = require("../../../../locators/publishWidgetspage.json");
|
||||
|
||||
describe("Test Create Api and Bind to Table widget", function() {
|
||||
before(() => {
|
||||
cy.addDsl(dsl);
|
||||
});
|
||||
|
||||
it("Test_Add users api and execute api", function() {
|
||||
cy.createAndFillApi(this.data.userApi, "/random");
|
||||
cy.RunAPI();
|
||||
});
|
||||
|
||||
it("Call the api without error handling", () => {
|
||||
cy.SearchEntityandOpen("Button1");
|
||||
cy.get(widgetsPage.toggleOnClick)
|
||||
.invoke("attr", "class")
|
||||
.then((classes) => {
|
||||
if (classes.includes("is-active")) {
|
||||
cy.get(widgetsPage.toggleOnClick).click();
|
||||
}
|
||||
});
|
||||
cy.get(widgetsPage.toggleOnClick).click();
|
||||
|
||||
cy.get(".t--property-control-onclick").then(($el) => {
|
||||
cy.updateCodeInput($el, "{{Api1.run()}}");
|
||||
});
|
||||
|
||||
cy.PublishtheApp();
|
||||
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
cy.wait("@postExecute").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
|
||||
cy.get(commonlocators.toastAction)
|
||||
.should("have.length", 1)
|
||||
.should("contain.text", "failed to execute");
|
||||
|
||||
cy.get(publishPage.backToEditor).click({ force: true });
|
||||
});
|
||||
|
||||
it("Call the api with error handling", () => {
|
||||
cy.SearchEntityandOpen("Button1");
|
||||
|
||||
cy.get(".t--property-control-onclick").then(($el) => {
|
||||
cy.updateCodeInput($el, "{{Api1.run(() => {}, () => {})}}");
|
||||
});
|
||||
|
||||
cy.PublishtheApp();
|
||||
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
cy.wait("@postExecute").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
200,
|
||||
);
|
||||
|
||||
cy.get(commonlocators.toastAction).should("not.exist");
|
||||
});
|
||||
});
|
||||
|
|
@ -66,7 +66,6 @@ export function* executeActionTriggers(
|
|||
executePluginActionTriggerSaga,
|
||||
trigger.payload,
|
||||
eventType,
|
||||
triggerMeta,
|
||||
);
|
||||
break;
|
||||
case ActionTriggerType.CLEAR_PLUGIN_ACTION:
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ import { RunPluginActionDescription } from "entities/DataTree/actionTriggers";
|
|||
import { APP_MODE } from "entities/App";
|
||||
import { FileDataTypes } from "widgets/constants";
|
||||
import { hideDebuggerErrors } from "actions/debuggerActions";
|
||||
import { TriggerMeta } from "sagas/ActionExecution/ActionExecutionSagas";
|
||||
import {
|
||||
PluginTriggerFailureError,
|
||||
PluginActionExecutionError,
|
||||
|
|
@ -243,7 +242,6 @@ function* confirmRunActionSaga() {
|
|||
export default function* executePluginActionTriggerSaga(
|
||||
pluginAction: RunPluginActionDescription["payload"],
|
||||
eventType: EventType,
|
||||
triggerMeta: TriggerMeta,
|
||||
) {
|
||||
const { actionId, params } = pluginAction;
|
||||
PerformanceTracker.startAsyncTracking(
|
||||
|
|
@ -310,7 +308,6 @@ export default function* executePluginActionTriggerSaga(
|
|||
throw new PluginTriggerFailureError(
|
||||
createMessage(ERROR_PLUGIN_ACTION_EXECUTE, action.name),
|
||||
[payload.body, params],
|
||||
triggerMeta,
|
||||
);
|
||||
} else {
|
||||
AppsmithConsole.info({
|
||||
|
|
|
|||
|
|
@ -58,15 +58,11 @@ export const logActionExecutionError = (
|
|||
});
|
||||
};
|
||||
|
||||
export class PluginTriggerFailureError extends TriggerFailureError {
|
||||
export class PluginTriggerFailureError extends Error {
|
||||
responseData: unknown[] = [];
|
||||
|
||||
constructor(
|
||||
reason: string,
|
||||
responseData: unknown[],
|
||||
triggerMeta: TriggerMeta,
|
||||
) {
|
||||
super(reason, triggerMeta);
|
||||
constructor(reason: string, responseData: unknown[]) {
|
||||
super(reason);
|
||||
this.responseData = responseData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user