Fix IObservable.ToUniTask does not propagate unobserved exception
parent
f63212aa17
commit
62ca0c6e92
|
@ -74,16 +74,19 @@ namespace Cysharp.Threading.Tasks
|
|||
|
||||
static async UniTaskVoid Fire<T>(AsyncSubject<T> subject, UniTask<T> task)
|
||||
{
|
||||
T value;
|
||||
try
|
||||
{
|
||||
var value = await task;
|
||||
subject.OnNext(value);
|
||||
subject.OnCompleted();
|
||||
value = await task;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
subject.OnError(ex);
|
||||
return;
|
||||
}
|
||||
|
||||
subject.OnNext(value);
|
||||
subject.OnCompleted();
|
||||
}
|
||||
|
||||
static async UniTaskVoid Fire(AsyncSubject<AsyncUnit> subject, UniTask task)
|
||||
|
@ -91,13 +94,15 @@ namespace Cysharp.Threading.Tasks
|
|||
try
|
||||
{
|
||||
await task;
|
||||
subject.OnNext(AsyncUnit.Default);
|
||||
subject.OnCompleted();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
subject.OnError(ex);
|
||||
return;
|
||||
}
|
||||
|
||||
subject.OnNext(AsyncUnit.Default);
|
||||
subject.OnCompleted();
|
||||
}
|
||||
|
||||
class ToUniTaskObserver<T> : IObserver<T>
|
||||
|
|
Loading…
Reference in New Issue