-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
fix: reject promise if deserializeMessage throws #413
fix: reject promise if deserializeMessage throws #413
Conversation
Is this testable? Would be nice to have one bad path test where it gets rejected 😅 Thanks anyway and if you don't find the time i can merge it |
I could try to take a look at this later today but in theory it shouldn't be too difficult (get some bad BSON data to cause an issue) |
@lucsoft it doesn't seem like there's an easy way to force MongoDB to return invalid bson so unless you know of a way to do that, I don't really know how I'd write a test for this |
@williamhorning well the only way would be to edit the raw bson like flipping a bit or something |
@lucsoft i don't really see a way of reliably doing that with the current CI setup. additionally, most people will probably never run into bson errors unless they're doing something weird or if there's a bug with mongodb |
@williamhorning okay then I just merge it |
Just fix CI and then I merge it |
@lucsoft i fixed CI |
if deserializeMessage throws for any reason (such as a BSONError), the pendingMessage promise will never resolve. this PR changes this behavior so that the promise will reject if there's an error thrown