mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Improve display of errors of Pipedrive-Node
This commit is contained in:
parent
c6345bad19
commit
f74a067c17
|
@ -53,9 +53,13 @@ export async function pipedriveApiRequest(this: IHookFunctions | IExecuteFunctio
|
||||||
throw new Error('The Pipedrive credentials are not valid!');
|
throw new Error('The Pipedrive credentials are not valid!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error.response && error.response.body && error.response.body.message) {
|
if (error.response && error.response.body && error.response.body.error) {
|
||||||
// Try to return the error prettier
|
// Try to return the error prettier
|
||||||
throw new Error(`Pipedrive error response [${error.statusCode}]: ${error.response.body.message}`);
|
let errorMessage = `Pipedrive error response [${error.statusCode}]: ${error.response.body.error}`;
|
||||||
|
if (error.response.body.error_info) {
|
||||||
|
errorMessage += ` - ${error.response.body.error_info}`;
|
||||||
|
}
|
||||||
|
throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If that data does not exist for some reason return the actual error
|
// If that data does not exist for some reason return the actual error
|
||||||
|
|
Loading…
Reference in a new issue