Closed jsalloway-godaddy closed 1 year ago
@jsalloway-godaddy Reading the code it seems that this should be handled via
Model.on(‘error’, () =>
does that not work? I’d like to see the application level code
@jcruger-godaddy You're correct, adding a listener to the Model in our codebase has provided the same functionality.
Receiving an error response from a Model action is currently not caught by the Model’s event emitter, which instead causes a
process.exit(1)
to be triggered. Adding anerror
event listener as part of the Model allows these errors to be captured without service termination.I’ve only implemented a basic
console.error
as part of the listener. I did try to implement anerrorCallback
that consumers can provide via theoptions
parameter in lib/index.js:92 but this was breaking existing functionality when arguments are manipulated.