refactor(core): Skip sending webhook activation errors to Sentry (no-changelog) (#7171)
This commit is contained in:
committed by
GitHub
parent
07d072c28f
commit
ebce6fe1b0
@@ -6,7 +6,7 @@ import type {
|
||||
WorkflowActivateMode,
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { WebhookPathAlreadyTakenError } from 'n8n-workflow';
|
||||
import * as NodeExecuteFunctions from 'n8n-core';
|
||||
|
||||
@Service()
|
||||
@@ -46,9 +46,7 @@ export class ActiveWebhooks {
|
||||
|
||||
// check that there is not a webhook already registered with that path/method
|
||||
if (this.webhookUrls[webhookKey] && !webhookData.webhookId) {
|
||||
throw new Error(
|
||||
`The URL path that the "${webhookData.node}" node uses is already taken. Please change it to something else.`,
|
||||
);
|
||||
throw new WebhookPathAlreadyTakenError(webhookData.node);
|
||||
}
|
||||
|
||||
if (this.workflowWebhooks[webhookData.workflowId] === undefined) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
WorkflowActivationError,
|
||||
LoggerProxy as Logger,
|
||||
ErrorReporterProxy as ErrorReporter,
|
||||
WebhookPathAlreadyTakenError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type express from 'express';
|
||||
@@ -428,11 +429,8 @@ export class ActiveWorkflowRunner implements IWebhookManager {
|
||||
// if it's a workflow from the the insert
|
||||
// TODO check if there is standard error code for duplicate key violation that works
|
||||
// with all databases
|
||||
if (error.name === 'QueryFailedError') {
|
||||
error = new Error(
|
||||
`The URL path that the "${webhook.node}" node uses is already taken. Please change it to something else.`,
|
||||
{ cause: error },
|
||||
);
|
||||
if (error instanceof Error && error.name === 'QueryFailedError') {
|
||||
error = new WebhookPathAlreadyTakenError(webhook.node, error);
|
||||
} else if (error.detail) {
|
||||
// it's a error running the webhook methods (checkExists, create)
|
||||
error.message = error.detail;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createHash } from 'crypto';
|
||||
import config from '@/config';
|
||||
import { ErrorReporterProxy, NodeError } from 'n8n-workflow';
|
||||
import { ErrorReporterProxy, ExecutionBaseError } from 'n8n-workflow';
|
||||
|
||||
let initialized = false;
|
||||
|
||||
@@ -39,7 +39,7 @@ export const initErrorHandling = async () => {
|
||||
|
||||
const seenErrors = new Set<string>();
|
||||
addGlobalEventProcessor((event, { originalException }) => {
|
||||
if (originalException instanceof NodeError && originalException.severity === 'warning')
|
||||
if (originalException instanceof ExecutionBaseError && originalException.severity === 'warning')
|
||||
return null;
|
||||
if (!event.exception) return null;
|
||||
const eventHash = createHash('sha1').update(JSON.stringify(event.exception)).digest('base64');
|
||||
|
||||
Reference in New Issue
Block a user