Files
Automata/packages/workflow/src/WorkflowErrors.ts
Omar Ajoue 67b88f75f4 feat(core): Add a warning to error workflows that cannot be started due to permission or settings (#6961)
Github issue / Community forum post (link here to close automatically):

This PR aims to address an issue where an Error workflow cannot be
started, either due to insufficient permissions or because its settings
prevent it from being called.

The way of addressing this is by creating a failed execution for the
appointed error workflow stating the error, as can be seen below.

This means the execution itself won't start, as it's prevented before
the execution beings, but we save a "stub" execution to show the error.

![Screenshot 2023-08-17 at 16 17
02](https://github.com/n8n-io/n8n/assets/219272/d8ec0144-13c5-4b11-b91c-a6b440816ccf)
2023-08-22 15:26:33 +02:00

42 lines
964 B
TypeScript

import type { INode } from './Interfaces';
import { ExecutionBaseError } from './NodeErrors';
/**
* Class for instantiating an operational error, e.g. a timeout error.
*/
export class WorkflowOperationError extends ExecutionBaseError {
node: INode | undefined;
timestamp: number;
lineNumber: number | undefined;
description: string | undefined;
constructor(message: string, node?: INode) {
super(message, { cause: undefined });
this.name = this.constructor.name;
this.node = node;
this.timestamp = Date.now();
}
}
export class SubworkflowOperationError extends WorkflowOperationError {
description = '';
cause: { message: string; stack: string };
constructor(message: string, description: string) {
super(message);
this.name = this.constructor.name;
this.description = description;
this.cause = {
message,
stack: this.stack as string,
};
}
}
export class CliWorkflowOperationError extends SubworkflowOperationError {}