bbc / sqs-consumer

Build Amazon Simple Queue Service (SQS) based applications without the boilerplate
https://bbc.github.io/sqs-consumer/
Other
1.74k stars 333 forks source link

Prevent `emitError` from causing a runtime error which prevents `changeVisibilityTimeout` from being called. #312

Closed glennflanagan closed 1 year ago

glennflanagan commented 2 years ago

Description

If handleMessage rejects with undefined or null then emitError will receive the same and will cause runtime error of TypeError: Cannot read property 'name' of undefined and will prevent changeVisibilityTimeout from being called.

Types of changes

nicholasgriffintn commented 1 year ago

I think really, handleMessage should just always reject with a proper error message, we definitely don't want to change our types here because of that, internally, we are always expecting an error to be an error, and would just external functions do the same.

github-actions[bot] commented 1 year ago

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.