refactor(core): Stop reporting non-error to sentry (issue 4229454473) (no-changelog) (#7525)

This PR aims to stop reporting issues such as [this
one](https://n8nio.sentry.io/issues/4229454473/events/42b96bfd6a334c15a84499e981cf90eb/?project=4503924908883968).

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Omar Ajoue 2023-10-27 09:25:07 +02:00 committed by GitHub
parent 12a89e6d14
commit 87996a1fcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -7,7 +7,7 @@ import type {
IRun,
ExecutionStatus,
} from 'n8n-workflow';
import { createDeferredPromise } from 'n8n-workflow';
import { WorkflowOperationError, createDeferredPromise } from 'n8n-workflow';
import type { ChildProcess } from 'child_process';
import type PCancelable from 'p-cancelable';
@ -190,13 +190,13 @@ export class ActiveExecutions {
* @param {string} executionId The id of the execution to wait for
*/
async getPostExecutePromise(executionId: string): Promise<IRun | undefined> {
if (this.activeExecutions[executionId] === undefined) {
throw new WorkflowOperationError(`There is no active execution with id "${executionId}".`);
}
// Create the promise which will be resolved when the execution finished
const waitPromise = await createDeferredPromise<IRun | undefined>();
if (this.activeExecutions[executionId] === undefined) {
throw new Error(`There is no active execution with id "${executionId}".`);
}
this.activeExecutions[executionId].postExecutePromises.push(waitPromise);
return waitPromise.promise();

View file

@ -15,6 +15,7 @@ export class WorkflowOperationError extends ExecutionBaseError {
constructor(message: string, node?: INode) {
super(message, { cause: undefined });
this.severity = 'warning';
this.name = this.constructor.name;
this.node = node;
this.timestamp = Date.now();