feat(editor): Improve errors in output panel (#8644)

Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
Giulio Andreini
2024-03-07 17:08:01 +01:00
committed by GitHub
parent 6e2aa405fc
commit 5301323906
38 changed files with 772 additions and 287 deletions

View File

@@ -9,6 +9,7 @@ import type {
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import { getGoogleAccessToken } from '../../../GenericFunctions';
import set from 'lodash/set';
export async function apiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
@@ -62,11 +63,15 @@ export async function apiRequest(
error.statusCode = '401';
}
if (error.message.includes('PERMISSION_DENIED')) {
const message = `Missing permissions for Google Sheet, ${error.message}}`;
const details = error.description ? ` Details of the error: ${error.description}.` : '';
const description = `Please check that the account you're using has the right permissions. (If you're trying to modify the sheet, you'll need edit access.)${details}`;
throw new NodeApiError(this.getNode(), error as JsonObject, { message, description });
if (error instanceof NodeApiError) {
if (error.message.includes('PERMISSION_DENIED')) {
const details = error.description ? ` Details of the error: ${error.description}.` : '';
const description = `Please check that the account you're using has the right permissions. (If you're trying to modify the sheet, you'll need edit access.)${details}`;
set(error, 'description', description);
}
throw error;
}
throw new NodeApiError(this.getNode(), error as JsonObject);