mongo
mongo copied to clipboard
fix: reject promise if deserializeMessage throws
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
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
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