Skip to content

Commit ee70e0e

Browse files
author
Eric PTAK
authored
Merge pull request #33 from myDevicesIoT/fix/refactor-error-message
fix: refactor error message forwarding
2 parents 240a866 + cdffecb commit ee70e0e

File tree

4 files changed

+6
-192
lines changed

4 files changed

+6
-192
lines changed

.eslintrc.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"prettier"
55
],
66

7-
"parser": "babel-eslint",
8-
97
"parserOptions": {
108
"ecmaVersion": 2018,
119
"sourceType": "module"

lib/Request.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ class Request {
233233
if (error instanceof CoreError) {
234234
return error;
235235
}
236-
const message = error.response?.body?.message || error.message || error;
236+
237+
const message =
238+
error.response && error.response.body && error.response.body.message
239+
? error.response.body.message
240+
: error.message || error;
237241

238242
error = new CoreError(message, { statusCode: error.status });
239243
return error;

package-lock.json

Lines changed: 0 additions & 187 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
"superagent": "^4.1.0"
2020
},
2121
"devDependencies": {
22-
"babel-eslint": "^10.1.0",
2322
"code": "^5.2.4",
2423
"dotenv": "^6.2.0",
2524
"eslint": "^6.8.0",
2625
"eslint-config-prettier": "^6.10.1",
26+
"eslint-plugin-prettier": "^3.1.2",
2727
"eslint-plugin-import": "^2.16.0",
2828
"eslint-plugin-mocha": "^5.2.1",
29-
"eslint-plugin-prettier": "^3.1.2",
3029
"mocha": "^7.1.1",
3130
"nock": "^12.0.2",
3231
"prettier": "^1.16.4",

0 commit comments

Comments
 (0)