mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Improvements
This commit is contained in:
@@ -29,14 +29,26 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||
if (Object.keys(body).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
return await this.helpers.requestOAuth2.call(this, 'youTubeOAuth2Api', options);
|
||||
} catch (error) {
|
||||
if (error.response && error.response.body && error.response.body.error) {
|
||||
|
||||
let errors = error.response.body.error.errors;
|
||||
let errors;
|
||||
|
||||
if (error.response && error.response.body) {
|
||||
|
||||
if (resource === '/upload/youtube/v3/videos') {
|
||||
error.response.body = JSON.parse(error.response.body);
|
||||
}
|
||||
|
||||
if (error.response.body.error) {
|
||||
|
||||
errors = error.response.body.error.errors;
|
||||
|
||||
errors = errors.map((e: IDataObject) => e.message);
|
||||
}
|
||||
|
||||
errors = errors.map((e: IDataObject) => e.message);
|
||||
// Try to return the error prettier
|
||||
throw new Error(
|
||||
`YouTube error response [${error.statusCode}]: ${errors.join('|')}`
|
||||
|
||||
Reference in New Issue
Block a user