refactor(core): Skip sending webhook activation errors to Sentry (no-changelog) (#7171)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-09-27 16:57:52 +02:00
committed by GitHub
parent 07d072c28f
commit ebce6fe1b0
5 changed files with 23 additions and 16 deletions

View File

@@ -104,7 +104,7 @@ const STATUS_CODE_MESSAGES: IStatusCodeMessages = {
const UNKNOWN_ERROR_MESSAGE = 'UNKNOWN ERROR - check the detailed error for more information';
const UNKNOWN_ERROR_MESSAGE_CRED = 'UNKNOWN ERROR';
type Severity = 'warning' | 'error';
export type Severity = 'warning' | 'error';
interface ExecutionBaseErrorOptions {
cause?: Error | JsonObject;
@@ -136,6 +136,8 @@ export abstract class ExecutionBaseError extends Error {
lineNumber: number | undefined;
severity: Severity = 'error';
constructor(message: string, { cause }: ExecutionBaseErrorOptions) {
const options = cause instanceof Error ? { cause } : {};
super(message, options);
@@ -171,8 +173,6 @@ export abstract class ExecutionBaseError extends Error {
export abstract class NodeError extends ExecutionBaseError {
node: INode;
severity: Severity = 'error';
constructor(node: INode, error: Error | JsonObject) {
const message = error instanceof Error ? error.message : '';
super(message, { cause: error });

View File

@@ -1,9 +1,10 @@
import type { INode } from './Interfaces';
import { ExecutionBaseError } from './NodeErrors';
import { ExecutionBaseError, type Severity } from './NodeErrors';
interface WorkflowActivationErrorOptions {
cause?: Error;
node?: INode;
severity?: Severity;
}
/**
@@ -12,7 +13,7 @@ interface WorkflowActivationErrorOptions {
export class WorkflowActivationError extends ExecutionBaseError {
node: INode | undefined;
constructor(message: string, { cause, node }: WorkflowActivationErrorOptions) {
constructor(message: string, { cause, node, severity }: WorkflowActivationErrorOptions) {
let error = cause as Error;
if (cause instanceof ExecutionBaseError) {
error = new Error(cause.message);
@@ -23,5 +24,15 @@ export class WorkflowActivationError extends ExecutionBaseError {
super(message, { cause: error });
this.node = node;
this.message = message;
if (severity) this.severity = severity;
}
}
export class WebhookPathAlreadyTakenError extends WorkflowActivationError {
constructor(nodeName: string, cause?: Error) {
super(
`The URL path that the "${nodeName}" node uses is already taken. Please change it to something else.`,
{ severity: 'warning', cause },
);
}
}