Skip to content

Exceptions thrown in 'message' event go unnotticed #3

@panickos

Description

@panickos

While using the 'message' event to process an incoming message on a worker I noticed that the worker was throwing an 'error' event on every single message but I was not getting anything in the error object.

After many hours I realized that the problem was within one of my functions processing said messages, but I couldn't realize from where since the exception thrown what getting lost.

I'm not sure if this is something you should fix or if I should just encapsulate all my code within try {} catch {} blocks.

i.e:

inboundQueueWorker.on('message', function(message, next, msgid) {
        try {
            ...
            next();
        } catch (e) {
            next(e)
        }
    });

I'd be interested to hear your opinion on this.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions