mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor: Switch plain errors in nodes-base to ApplicationError (no-changelog) (#7914)
Ensure all errors in `nodes-base` are `ApplicationError` or children of it and contain no variables in the message, to continue normalizing all the backend errors we report to Sentry. Also, skip reporting to Sentry errors from user input and from external APIs. In future we should refine `ApplicationError` to more specific errors. Follow-up to: [#7877](https://github.com/n8n-io/n8n/pull/7877) - [x] Test workflows: https://github.com/n8n-io/n8n/actions/runs/7084627970 - [x] e2e: https://github.com/n8n-io/n8n/actions/runs/7084936861 --------- Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import type {
|
||||
IHttpRequestOptions,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { deepCopy } from 'n8n-workflow';
|
||||
import { ApplicationError, deepCopy } from 'n8n-workflow';
|
||||
|
||||
import type { IRequestBody } from './types';
|
||||
|
||||
@@ -43,13 +43,13 @@ export async function awsApiRequest(
|
||||
|
||||
if (statusCode === 403) {
|
||||
if (errorMessage === 'The security token included in the request is invalid.') {
|
||||
throw new Error('The AWS credentials are not valid!');
|
||||
throw new ApplicationError('The AWS credentials are not valid!', { level: 'warning' });
|
||||
} else if (
|
||||
errorMessage.startsWith(
|
||||
'The request signature we calculated does not match the signature you provided',
|
||||
)
|
||||
) {
|
||||
throw new Error('The AWS credentials are not valid!');
|
||||
throw new ApplicationError('The AWS credentials are not valid!', { level: 'warning' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,9 @@ export async function awsApiRequest(
|
||||
} catch (ex) {}
|
||||
}
|
||||
|
||||
throw new Error(`AWS error response [${statusCode}]: ${errorMessage}`);
|
||||
throw new ApplicationError(`AWS error response [${statusCode}]: ${errorMessage}`, {
|
||||
level: 'warning',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user