Throw.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Reactive.Concurrency;
  5. using System.Reactive.Disposables;
  6. namespace System.Reactive.Linq
  7. {
  8. partial class AsyncObservable
  9. {
  10. public static IAsyncObservable<TSource> Throw<TSource>(Exception error)
  11. {
  12. if (error == null)
  13. throw new ArgumentNullException(nameof(error));
  14. return Create<TSource>(async observer =>
  15. {
  16. await observer.OnErrorAsync(error).ConfigureAwait(false);
  17. return AsyncDisposable.Nop;
  18. });
  19. }
  20. public static IAsyncObservable<TSource> Throw<TSource>(Exception error, IAsyncScheduler scheduler)
  21. {
  22. if (error == null)
  23. throw new ArgumentNullException(nameof(error));
  24. if (scheduler == null)
  25. throw new ArgumentNullException(nameof(scheduler));
  26. throw new NotImplementedException();
  27. }
  28. }
  29. }