mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Small improvements to Zendesk-Node
This commit is contained in:
@@ -34,7 +34,14 @@ export async function zendeskApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (err) {
|
||||
const errorMessage = err.response.body.description || err.response.body;
|
||||
let errorMessage = err.message;
|
||||
if (err.response && err.response.body && err.response.body.error) {
|
||||
errorMessage = err.response.body.error;
|
||||
if (typeof err.response.body.error !== 'string') {
|
||||
errorMessage = JSON.stringify(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Zendesk error response [${err.statusCode}]: ${errorMessage}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user