fix(core): Deduplicate error handling in nodes (#4319)

* Fix issue with isAxios property

* 🥅 Deduplicate errors handeling improve errors for credentials

* 🎨 correctly throws error
This commit is contained in:
agobrech
2022-11-11 11:32:43 +01:00
committed by GitHub
parent d35d63a855
commit c7133ecd3f
35 changed files with 50 additions and 187 deletions

View File

@@ -31,12 +31,5 @@ export async function twakeApiRequest(
// options.uri = `${credentials!.hostUrl}/api/v1${resource}`;
// }
try {
return await this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options);
} catch (error) {
if (error.error?.code === 'ECONNREFUSED') {
throw new NodeApiError(this.getNode(), error, { message: 'Twake host is not accessible!' });
}
throw new NodeApiError(this.getNode(), error);
}
return await this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options);
}