mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
⚡ Small improvements to Hubspot-Node
This commit is contained in:
parent
1484427a59
commit
6cc1c771ea
|
@ -141,7 +141,7 @@ export const companyFields = [
|
||||||
description: 'The domain name of the company or organization'
|
description: 'The domain name of the company or organization'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Company Owmer',
|
displayName: 'Company Owner',
|
||||||
name: 'companyOwner',
|
name: 'companyOwner',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
|
|
|
@ -33,7 +33,13 @@ export async function hubspotApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.body && error.response.body.errors) {
|
if (error.response && error.response.body && error.response.body.errors) {
|
||||||
// Try to return the error prettier
|
// 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('|')}`);
|
throw new Error(`Hubspot error response [${error.statusCode}]: ${errorMessages.join('|')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue