cht-conf 3.9.3 → 3.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.9.4](https://github.com/medic/cht-conf/compare/v3.9.3...v3.9.4) (2022-01-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **#460:** log useful error messages when api connection fails ([#461](https://github.com/medic/cht-conf/issues/461)) ([095a55c](https://github.com/medic/cht-conf/commit/095a55c9254c6872696cbee2fe42f244fc1fc4a8)), closes [#460](https://github.com/medic/cht-conf/issues/460) [#460](https://github.com/medic/cht-conf/issues/460)
7
+
1
8
  ## [3.9.3](https://github.com/medic/cht-conf/compare/v3.9.2...v3.9.3) (2021-12-16)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cht-conf",
3
- "version": "3.9.3",
3
+ "version": "3.9.4",
4
4
  "description": "Configure CHT deployments",
5
5
  "main": "./src/lib/main.js",
6
6
  "engines": {
package/src/lib/api.js CHANGED
@@ -99,8 +99,19 @@ const api = {
99
99
  await request.get(url);
100
100
  return true;
101
101
  } catch (err) {
102
- log.error(`Failed to get a response from ${url}. Maybe you entered the wrong URL, `
103
- + 'wrong port or the instance is not started? Please check and try again.');
102
+ if (err.statusCode === 401) {
103
+ log.error(`Authentication failed connecting to ${url}. `
104
+ + 'Check the supplied username and password and try again.');
105
+ } else if (err.statusCode === 403) {
106
+ log.error(`Insufficient permissions connecting to ${url}. `
107
+ + 'You need to use admin permissions to execute this command.');
108
+ } else if (err.statusCode) {
109
+ log.error(`Received error code ${err.statusCode} connecting to ${url}. `
110
+ + 'Check the server and and try again.');
111
+ } else {
112
+ log.error(`Failed to get a response from ${url}. Maybe you entered the wrong URL, `
113
+ + 'wrong port or the instance is not started. Please check and try again.');
114
+ }
104
115
  return false;
105
116
  }
106
117
  },