Skip to content

Commit

Permalink
Update: handle array of errors at main error handler (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
alewitt2 authored Sep 4, 2020
1 parent dd95962 commit 6d7b17d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/BaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ module.exports = class BaseController {
} catch (e) {
try {
this.errorHandler(e);
await this.updateRazeeLogs('error', e.message || e);
const errArr = Array.isArray(e) ? e : [e];
for (let i = 0; i < errArr.length; i++) {
await this.updateRazeeLogs('error', errArr[i].message || errArr[i]);
}
await this._reconcileRazeeLogs();
} catch (e) {
this._logger.error(e);
Expand All @@ -111,7 +114,7 @@ module.exports = class BaseController {
}

errorHandler(err) {
this._logger.error(err, this._data);
this._logger.error(`${this.selfLink}: `, err);
}

// the handler calls the underscored event function to allow pre/post processesing
Expand Down

0 comments on commit 6d7b17d

Please sign in to comment.