Given the following snippet
var connection = Session.MarketRecords.Connect()
.Group(r => r.SettledDate.Date)
.Transform(grouping => new DayReport(grouping))
.Bind(DayReports, Updater)
.Subscribe();
Looks like exceptions that are thrown within the Transform function are being swallowed and thus making it hard to figure out when things go wrong. I was only able to identify this because the DayReports "list" was not being populated (and I knew there were records) so I thought it could be the Binding that was wrong but after putting breakpoints "everywhere" I figured the constructor of DayReport had a bug which would cause an exception to be thrown under certain circumstances. Is there any recommended way to capture exceptions that occur under these circumstances?
This has been replied on the Reactive slack, so I'm posting it here for reference.
Subscribe
has an overload that takes two arguments, the second one being an exception handler and that would be the appropriate way of handling exceptions thrown during any of the previous calls. So the following worked fine:
var connection = Session.MarketRecords.Connect()
.Group(r => r.SettledDate.Date)
.Transform(grouping => new DayReport(grouping))
.Bind(DayReports, Updater)
.Subscribe((change) =>
{
Console.WriteLine(change.Count);
},
(ex) =>
{
Console.WriteLine(ex.Message);
});