refactor: Unify severity and level for all application errors for Sentry (no-changelog) (#7956)
## Summary Unify `severity` and `level` for all backend application errors for Sentry Follow-up to: https://github.com/n8n-io/n8n/pull/7914#issuecomment-1840433542 ... #### How to test the change: 1. ... ## Issues fixed Include links to Github issue or Community forum post or **Linear ticket**: > Important in order to close automatically and provide context to reviewers ... ## Review / Merge checklist - [ ] PR title and summary are descriptive. **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** ([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md)) - [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up ticket created. - [ ] Tests included. > A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests. > > *(internal)* You can use Slack commands to trigger [e2e tests](https://www.notion.so/n8n/How-to-use-Test-Instances-d65f49dfc51f441ea44367fb6f67eb0a?pvs=4#a39f9e5ba64a48b58a71d81c837e8227) or [deploy test instance](https://www.notion.so/n8n/How-to-use-Test-Instances-d65f49dfc51f441ea44367fb6f67eb0a?pvs=4#f6a177d32bde4b57ae2da0b8e454bfce) or [deploy early access version on Cloud](https://www.notion.so/n8n/Cloudbot-3dbe779836004972b7057bc989526998?pvs=4#fef2d36ab02247e1a0f65a74f6fb534e).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { createHash } from 'crypto';
|
||||
import config from '@/config';
|
||||
import { ErrorReporterProxy, ApplicationError, ExecutionBaseError } from 'n8n-workflow';
|
||||
import { ErrorReporterProxy, ApplicationError } from 'n8n-workflow';
|
||||
|
||||
let initialized = false;
|
||||
|
||||
@@ -39,9 +39,6 @@ export const initErrorHandling = async () => {
|
||||
|
||||
const seenErrors = new Set<string>();
|
||||
addGlobalEventProcessor((event, { originalException }) => {
|
||||
if (originalException instanceof ExecutionBaseError && originalException.severity === 'warning')
|
||||
return null;
|
||||
|
||||
if (originalException instanceof ApplicationError) {
|
||||
const { level, extra } = originalException;
|
||||
if (level === 'warning') return null;
|
||||
|
||||
@@ -72,7 +72,7 @@ export class PermissionChecker {
|
||||
|
||||
throw new NodeOperationError(nodeToFlag, 'Node has no access to credential', {
|
||||
description: 'Please recreate the credential or ask its owner to share it with you.',
|
||||
severity: 'warning',
|
||||
level: 'warning',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ export class PermissionChecker {
|
||||
if (!cred.id) {
|
||||
throw new NodeOperationError(node, 'Node uses invalid credential', {
|
||||
description: 'Please recreate the credential.',
|
||||
severity: 'warning',
|
||||
level: 'warning',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { ApplicationError, type Severity } from 'n8n-workflow';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
export class CredentialNotFoundError extends ApplicationError {
|
||||
severity: Severity;
|
||||
|
||||
constructor(credentialId: string, credentialType: string) {
|
||||
super(`Credential with ID "${credentialId}" does not exist for type "${credentialType}".`);
|
||||
this.severity = 'warning';
|
||||
this.level = 'warning';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user