Skip to content

Commit

Permalink
Merge pull request #51 from envoy/fix-plugin-install-config-catch
Browse files Browse the repository at this point in the history
SQ-4167: fix promise handling on plugin install config call
  • Loading branch information
johnmarrero authored Jan 23, 2024
2 parents dea5dd5 + 0aa1d94 commit 24ec41b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
15 changes: 7 additions & 8 deletions lib/EnvoyAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,14 @@ class EnvoyAPI {
* @returns {Promise<{}>}
*/
async getPluginInstallConfig(installId) {
return new Promise((resolve, reject) => {
this.request({
method: 'GET',
url: `/api/v2/plugin-services/installs/${installId}/config`,
}).then(body => resolve(EnvoyAPI.getDataFromBody(body)))
.catch((error) => {
EnvoyAPI.safeRequestsError(error).catch((err) => reject(err));
});
const body = await this.request({
method: 'GET',
url: `/api/v2/plugin-services/installs/${installId}/config`,
}).catch((error) => {
return EnvoyAPI.safeRequestsError(error);
});

return EnvoyAPI.getDataFromBody(body);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@envoy/envoy-integrations-sdk",
"version": "1.4.1",
"version": "1.4.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 24ec41b

Please sign in to comment.