Add ErrorChanged event to propagate DataStream exceptions

This commit is contained in:
John Colvin committed 2025-11-03 16:13:19 -05:00
1 parent 6aee76590f
commit cd7c04dce5
4 files changed
+148 -57

No files matched your search

@@ -32,6 +32,9 @@ namespace BCG
public DataStream (DataStream realSource)
{
myRealSource = realSource;
if (myRealSource is not null) {
myRealSource.ErrorChanged += OnError;
}
myOnChangeDelegate = null;
myPendingAdds = new Stack();
}
@@ -121,8 +124,15 @@ namespace BCG
protected virtual object myGetValueForInitialSubscription()
{return myLastValue;}
protected void mySetRealSource (DataStream src)
{myRealSource = src;}
protected void mySetRealSource (DataStream src) {
if (myRealSource is not null) {
myRealSource.ErrorChanged -= OnError;
}
myRealSource = src;
if (myRealSource is not null) {
myRealSource.ErrorChanged += OnError;
}
}
protected virtual void myOnFirstSubscriber() {myFirstSubImplemented = false;}
protected virtual void myOnLastSubscriber () {myLastSubImplemented = false;}
@@ -144,6 +154,11 @@ namespace BCG
}
}
protected void OnError(Exception error) {
Log.Gen.error($"{GetType()} OnError: {error}");
ErrorChanged?.Invoke(error);
}
public Guid ID
{
get
@@ -1,11 +1,9 @@
using System;
using BCG.Utilities;
using Bts.DataStream;
using mbts.config;
using System;
namespace BCG
{
/// <summary>
@@ -17,14 +15,26 @@ namespace BCG
protected bool myUseUncopiedNewRowsInFireEvent =
Configuration.get<DataStreamConfig>().UseUncopiedNewRowsInFire;
string streamName;
public ViewStream (ViewStream sourceStream)
:
base(sourceStream)
{}
public ViewStream(string streamName) {
this.streamName = streamName;
}
public ViewStream()
{}
public Guid StreamId { get; } = Guid.NewGuid();
public string StreamName => streamName
?? (myRealSource as ViewStream)?.StreamName
?? GetType().Name;
public IBlueRowCollection rows
{
get