feat(editor): Improve errors in output panel (#8644)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user