mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Small improvements to Hubspot-Node
This commit is contained in:
@@ -33,7 +33,13 @@ export async function hubspotApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
} catch (error) {
|
||||
if (error.response && error.response.body && error.response.body.errors) {
|
||||
// Try to return the error prettier
|
||||
const errorMessages = error.response.body.errors;
|
||||
let errorMessages = error.response.body.errors;
|
||||
|
||||
if (errorMessages[0].message) {
|
||||
// @ts-ignore
|
||||
errorMessages = errorMessages.map(errorItem => errorItem.message);
|
||||
}
|
||||
|
||||
throw new Error(`Hubspot error response [${error.statusCode}]: ${errorMessages.join('|')}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user