fail() public method

Marks the observable as complete with the given error.
public fail ( Throwable $exception )
$exception Throwable
コード例 #1
0
ファイル: Emitter.php プロジェクト: Nik-ADA/icicle
 /**
  * {@inheritdoc}
  */
 public function dispose(Throwable $exception = null)
 {
     if (null === $exception) {
         $exception = new DisposedException();
     }
     $this->emitter = null;
     if (null === $this->coroutine) {
         $this->queue->fail($exception);
         return;
     }
     if (null !== $this->onDisposed) {
         try {
             $result = ($this->onDisposed)($exception);
             if ($result instanceof Generator) {
                 $awaitable = new Coroutine($result);
             } else {
                 $awaitable = resolve($result);
             }
             $awaitable = $awaitable->then(function () use($exception) {
                 throw $exception;
             });
         } catch (Throwable $exception) {
             $awaitable = reject($exception);
         }
     } else {
         $awaitable = reject($exception);
     }
     $awaitable->done(null, [$this->coroutine, 'cancel']);
 }
コード例 #2
0
ファイル: Emitter.php プロジェクト: mrxotey/icicle
 /**
  * {@inheritdoc}
  */
 public function dispose(Throwable $exception = null)
 {
     if (null === $exception) {
         $exception = new DisposedException('Observable disposed.');
     }
     $this->emitter = null;
     $this->queue->fail($exception);
     if (null !== $this->coroutine) {
         $this->coroutine->cancel($exception);
     }
 }