Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differentiate between internal and external events #16

Closed
owais opened this issue Oct 21, 2015 · 5 comments
Closed

Differentiate between internal and external events #16

owais opened this issue Oct 21, 2015 · 5 comments

Comments

@owais
Copy link

owais commented Oct 21, 2015

Is there a way to tell if an error was raised by client code (one of the message processing handlers) or by the library (sqs-consumer) internally without manually checking for all types of events sqs-consumer could possibly raise?

@robinjmurphy
Copy link
Contributor

Not currently no. Arguably we shouldn't really be firing the error event when the processMessage function returns an error. Would this change make things clearer for you? You always have access to the processMessage error anyway as it comes from your code.

@robinjmurphy
Copy link
Contributor

This would mean that only errors polling/deleting are surfaced by the error event.

@owais
Copy link
Author

owais commented Oct 21, 2015

Not currently no. Arguably we shouldn't really be firing the error event when the processMessage function returns an error. Would this change make things clearer for you? You always have access to the processMessage error anyway as it comes from your code.

This would essentially solve the problem at the cost of a minor inconvenience as I'm using this event to log our own events in different ways. I'd have to write a proxy callback to get errors from handlers, log them and call the real callback.

I guess a good solution would be to have 2 separate events for each type of error.

@pablovilas
Copy link
Contributor

I've added a pr for this. #20

@robinjmurphy
Copy link
Contributor

Fixed in #20. Released as 3.0.0 https://github.com/bbc/sqs-consumer/releases/tag/v3.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants