Minor improvements to Wordpress-Node

This commit is contained in:
Jan Oberhauser
2020-09-16 08:35:26 +02:00
parent 615a44726d
commit 7c54cf6ac2
2 changed files with 4 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ export async function wordpressApiRequest(this: IExecuteFunctions | IExecuteSing
method,
qs,
body,
uri: uri ||`${credentials!.url}/wp-json/wp/v2${resource}`,
uri: uri || `${credentials!.url}/wp-json/wp/v2${resource}`,
json: true
};
options = Object.assign({}, options, option);
@@ -41,7 +41,7 @@ export async function wordpressApiRequest(this: IExecuteFunctions | IExecuteSing
return await this.helpers.request!(options);
} catch (error) {
let errorMessage = error.message;
if (error.response.body) {
if (error.response && error.response.body) {
errorMessage = error.response.body.message || error.response.body.Message || error.message;
}