Skip to content

Commit

Permalink
fix: workaround for loopback 2.x circular json error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Kirkpatrick authored and Tom Kirkpatrick committed Jun 30, 2017
1 parent f2f60ee commit 6bb1fa9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/mixins/state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,17 @@ module.exports = function StateMachine(Model, settings) {
// Run the event method.
return fms[eventName](this, ...args)
.then(result => result)
.catch(err => {
if (Model.app.loopback.version.startsWith(2)) {
try {
JSON.stringify(err)
}
catch (e) {
_.unset(err, '[email protected]')
}
}
throw err
})
.finally(() => Model.app.deleteStateMachine(this))
}
})
Expand Down

0 comments on commit 6bb1fa9

Please sign in to comment.