Skip to content

Commit 240a866

Browse files
author
Eric PTAK
authored
Merge pull request #32 from myDevicesIoT/fix/forward-error-message
fix: forward service error message
2 parents 3aa2061 + d5bed6f commit 240a866

File tree

4 files changed

+193
-2
lines changed

4 files changed

+193
-2
lines changed

.eslintrc.json

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

7+
"parser": "babel-eslint",
8+
79
"parserOptions": {
810
"ecmaVersion": 2018,
911
"sourceType": "module"

lib/Request.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ class Request {
233233
if (error instanceof CoreError) {
234234
return error;
235235
}
236+
const message = error.response?.body?.message || error.message || error;
236237

237-
error = new CoreError(error, { statusCode: error.status });
238+
error = new CoreError(message, { statusCode: error.status });
238239
return error;
239240
}
240241

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
"superagent": "^4.1.0"
2020
},
2121
"devDependencies": {
22+
"babel-eslint": "^10.1.0",
2223
"code": "^5.2.4",
2324
"dotenv": "^6.2.0",
2425
"eslint": "^6.8.0",
2526
"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",
2930
"mocha": "^7.1.1",
3031
"nock": "^12.0.2",
3132
"prettier": "^1.16.4",

0 commit comments

Comments
 (0)