[JAVA-4304] Propagate exceptions thrown in map or flatmap for Observable Created: 16/Sep/21 Updated: 28/Oct/23 Resolved: 04/Oct/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Scala |
| Affects Version/s: | None |
| Fix Version/s: | 4.3.3 |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Colin Fairless | Assignee: | Ross Lawley |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | external-user | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
mongo-scala-driver: 4.3.1 exceptions thrown in map or flatmap for Observable are not propagated up. take for example
this future will never complete and lead to a timeout. Only exceptions thrown in an Observable are propagated up. e.g. using a `raiseError` defined as such
It would seem resolvable by changing `onNext` in MapObservable to
and FlatMapObservable similarly. |
| Comments |
| Comment by Githook User [ 04/Oct/21 ] | |||||||||||||
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Scala Observables fix (#787) Should handle errors from user functions gracefully
| |||||||||||||
| Comment by Githook User [ 04/Oct/21 ] | |||||||||||||
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Scala Observables fix (#787) Should handle errors from user functions gracefully
| |||||||||||||
| Comment by Ross Lawley [ 24/Sep/21 ] | |||||||||||||
|
Thanks colin.fairless@digital.hmrc.gov.uk for reporting this. I've put a fix in for code review. Thanks again, Ross | |||||||||||||
| Comment by Ross Lawley [ 24/Sep/21 ] | |||||||||||||
| Comment by Ross Lawley [ 24/Sep/21 ] | |||||||||||||
|
The Reactive Streams specification: section 2.13 states:
So it is the responsibility of the Observable (Publisher) to behave correctly and so should call onError if the mapping function fails. The following example using reactor behaves that way:
|