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