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)
|
static async UniTaskVoid Fire<T>(AsyncSubject<T> subject, UniTask<T> task)
|
||||||
{
|
{
|
||||||
|
T value;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var value = await task;
|
value = await task;
|
||||||
subject.OnNext(value);
|
|
||||||
subject.OnCompleted();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
subject.OnError(ex);
|
subject.OnError(ex);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subject.OnNext(value);
|
||||||
|
subject.OnCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
static async UniTaskVoid Fire(AsyncSubject<AsyncUnit> subject, UniTask task)
|
static async UniTaskVoid Fire(AsyncSubject<AsyncUnit> subject, UniTask task)
|
||||||
|
@ -91,13 +94,15 @@ namespace Cysharp.Threading.Tasks
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await task;
|
await task;
|
||||||
subject.OnNext(AsyncUnit.Default);
|
|
||||||
subject.OnCompleted();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
subject.OnError(ex);
|
subject.OnError(ex);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subject.OnNext(AsyncUnit.Default);
|
||||||
|
subject.OnCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ToUniTaskObserver<T> : IObserver<T>
|
class ToUniTaskObserver<T> : IObserver<T>
|
||||||
|
|
Loading…
Reference in New Issue