diff --git a/packages/node_modules/@node-red/runtime/lib/api/flows.js b/packages/node_modules/@node-red/runtime/lib/api/flows.js index 9240a85d3..811d7b5cb 100644 --- a/packages/node_modules/@node-red/runtime/lib/api/flows.js +++ b/packages/node_modules/@node-red/runtime/lib/api/flows.js @@ -194,14 +194,13 @@ var api = module.exports = { var id = opts.id; return runtime.flows.removeFlow(id, opts.user).then(function () { runtime.log.audit({event: "flow.remove", id: id}, opts.req); - return resolve(); + return; }).catch(function (err) { if (err.code === 404) { runtime.log.audit({event: "flow.remove", id: id, error: "not_found"}, opts.req); // TODO: this swap around of .code and .status isn't ideal err.status = 404; err.code = "not_found"; - return reject(err); } else { runtime.log.audit({ event: "flow.remove", diff --git a/test/unit/@node-red/runtime/lib/api/flows_spec.js b/test/unit/@node-red/runtime/lib/api/flows_spec.js index c0b7d1cb3..9062ef52f 100644 --- a/test/unit/@node-red/runtime/lib/api/flows_spec.js +++ b/test/unit/@node-red/runtime/lib/api/flows_spec.js @@ -255,7 +255,9 @@ describe("runtime-api/flows", function() { var err = new Error(); // TODO: quirk of internal api - uses .code for .status err.code = 404; - throw err; + var p = Promise.reject(err); + p.catch(()=>{}); + return p; } else if (id === "error") { var err = new Error(); // TODO: quirk of internal api - uses .code for .status @@ -311,7 +313,9 @@ describe("runtime-api/flows", function() { var err = new Error(); // TODO: quirk of internal api - uses .code for .status err.code = 404; - throw err; + var p = Promise.reject(err); + p.catch(()=>{}); + return p; } else if (flow === "error") { var err = new Error(); // TODO: quirk of internal api - uses .code for .status