Skip to content

Commit

Permalink
fix: handle errors that are objects (#220)
Browse files Browse the repository at this point in the history
* fix: handle errors that are objects

* fix: use typeof === object
  • Loading branch information
alewitt2 authored Apr 15, 2021
1 parent f2188f4 commit 4f05895
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/BaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ module.exports = class BaseController {
}

errorHandler(err) {
if (typeof err === 'object') {
try {
err = JSON.stringify(err);
} catch (error) {
this._logger.error(`${this.selfLink}: failing to stringify error object - ${error}`);
}
}
this._logger.error(`${this.selfLink}: ${err.toString()}`);
}

Expand Down

0 comments on commit 4f05895

Please sign in to comment.