Skip to content

Commit

Permalink
Merge pull request #33 from myDevicesIoT/fix/refactor-error-message
Browse files Browse the repository at this point in the history
fix: refactor error message forwarding
  • Loading branch information
eptak authored Mar 25, 2021
2 parents 240a866 + cdffecb commit ee70e0e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 192 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"prettier"
],

"parser": "babel-eslint",

"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
Expand Down
6 changes: 5 additions & 1 deletion lib/Request.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ class Request {
if (error instanceof CoreError) {
return error;
}
const message = error.response?.body?.message || error.message || error;

const message =
error.response && error.response.body && error.response.body.message
? error.response.body.message
: error.message || error;

error = new CoreError(message, { statusCode: error.status });
return error;
Expand Down
187 changes: 0 additions & 187 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
"superagent": "^4.1.0"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"code": "^5.2.4",
"dotenv": "^6.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-mocha": "^5.2.1",
"eslint-plugin-prettier": "^3.1.2",
"mocha": "^7.1.1",
"nock": "^12.0.2",
"prettier": "^1.16.4",
Expand Down

0 comments on commit ee70e0e

Please sign in to comment.