當前位置: 首頁>>代碼示例>>PHP>>正文


PHP onError函數代碼示例

本文整理匯總了PHP中onError函數的典型用法代碼示例。如果您正苦於以下問題:PHP onError函數的具體用法?PHP onError怎麽用?PHP onError使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了onError函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getMysqli

function getMysqli()
{
    $_db = new mysqli(HOST, DB_USER, DB_PASS, DB);
    if ($_db->connect_errno > 0) {
        onError("Unable to connect to database.", $_db->connect_error);
    }
    return $_db;
}
開發者ID:gogolB,項目名稱:pinkies2,代碼行數:8,代碼來源:functions.php

示例2: sum_number_throw

 /**
  * Adapted from RxJS
  *
  * @test
  */
 public function sum_number_throw()
 {
     $xs = $this->createHotObservable([onNext(150, 1), onError(210, new \Exception())]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->sum();
     });
     $this->assertMessages([onError(210, new \Exception())], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:13,代碼來源:SumTest.php

示例3: select_calls_on_error

 /**
  * @test
  */
 public function select_calls_on_error()
 {
     $xs = $this->createHotObservable(array(onError(500, new Exception())));
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->select('RxIdentity');
     });
     $this->assertMessages(array(onError(500, new Exception())), $results->getMessages());
 }
開發者ID:Gasperowicz,項目名稱:Rx.PHP,代碼行數:11,代碼來源:SelectTest.php

示例4: timestamp_error

 /**
  * @test
  */
 public function timestamp_error()
 {
     $error = new \Exception();
     $results = $this->scheduler->startWithCreate(function () use($error) {
         return Observable::error($error)->timestamp($this->scheduler);
     });
     $this->assertMessages([onError(201, $error)], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:11,代碼來源:TimestampTest.php

示例5: startWith_error

 /**
  * @test
  */
 public function startWith_error()
 {
     $error = new \Exception();
     $xs = $this->createHotObservable([onNext(150, 1), onError(250, $error)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->startWithArray([1, 2, 3]);
     });
     $this->assertMessages([onNext(201, 1), onNext(202, 2), onNext(203, 3), onError(250, $error)], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:12,代碼來源:StartWithTest.php

示例6: testAsObservableThrow

 public function testAsObservableThrow()
 {
     $error = new Exception();
     $xs = $this->createHotObservable([onNext(150, 1), onError(250, $error)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->asObservable();
     });
     $this->assertMessages([onError(250, $error)], $results->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:9,代碼來源:AsObservableTest.php

示例7: switchLatest_outer_throws

 /**
  * @test
  */
 public function switchLatest_outer_throws()
 {
     $error = new \Exception();
     $xs = $this->createHotObservable([onNext(300, $this->createColdObservable([onNext(10, 101), onNext(20, 102), onNext(110, 103), onNext(120, 104), onNext(210, 105), onNext(220, 106), onCompleted(230)])), onNext(400, $this->createColdObservable([onNext(10, 201), onNext(20, 202), onNext(30, 203), onNext(40, 204), onCompleted(50)])), onError(500, $error)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->switchLatest();
     });
     $this->assertMessages([onNext(310, 101), onNext(320, 102), onNext(410, 201), onNext(420, 202), onNext(430, 203), onNext(440, 204), onError(500, $error)], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:12,代碼來源:SwitchLatestTest.php

示例8: pluck_object_property_missing

 /**
  * @test
  */
 public function pluck_object_property_missing()
 {
     $xs = $this->createHotObservable([onNext(180, (object) ['prop' => 1]), onNext(210, (object) ['prop' => 2]), onNext(240, (object) ['prop' => 3]), onNext(290, new \stdClass()), onNext(350, (object) ['prop' => 5]), onError(400, new \Exception())]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->pluck('prop');
     });
     $this->assertMessages([onNext(210, 2), onNext(240, 3), onError(290, new \Exception())], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 290)], $xs->getSubscriptions());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:12,代碼來源:PluckTest.php

示例9: bufferWithCountError

 /**
  * @test
  */
 public function bufferWithCountError()
 {
     $error = new \Exception();
     $xs = $this->createHotObservable([onNext(150, 1), onNext(210, 2), onNext(220, 3), onNext(230, 4), onNext(240, 5), onError(250, $error)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->bufferWithCount(5);
     });
     $this->assertMessages([onError(250, $error)], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:12,代碼來源:BufferWithCountTest.php

示例10: start_with_error

 /**
  * @test
  */
 public function start_with_error()
 {
     $error = new \Exception();
     $results = $this->scheduler->startWithCreate(function () use($error) {
         return Observable::start(function () use($error) {
             throw $error;
         }, $this->scheduler);
     });
     $this->assertMessages([onError(200, $error)], $results->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:13,代碼來源:StartTest.php

示例11: subscribeOn_error

 /**
  * @test
  */
 public function subscribeOn_error()
 {
     $error = new \Exception();
     $xs = $this->createHotObservable([onNext(150, 1), onError(210, $error)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->subscribeOn($this->scheduler);
     });
     $this->assertMessages([onError(210, $error)], $results->getMessages());
     $this->assertSubscriptions([subscribe(201, 211)], $xs->getSubscriptions());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:13,代碼來源:SubscribeOnTest.php

示例12: calls_on_error_if_predicate_throws_an_exception

 /**
  * @test
  */
 public function calls_on_error_if_predicate_throws_an_exception()
 {
     $xs = $this->createHotObservable(array(onNext(500, 42)));
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->where(function () {
             throw new Exception();
         });
     });
     $this->assertMessages(array(onError(500, new Exception())), $results->getMessages());
 }
開發者ID:Gasperowicz,項目名稱:Rx.PHP,代碼行數:13,代碼來源:WhereTest.php

示例13: throttle_error

 /**
  * @test
  */
 public function throttle_error()
 {
     $error = new \Exception();
     $xs = $this->createHotObservable([onNext(150, 1), onNext(210, 2), onNext(250, 3), onNext(310, 4), onNext(350, 5), onError(410, $error), onNext(450, 7), onCompleted(500)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->throttle(200);
     });
     $this->assertMessages([onNext(210, 2), onError(410, $error)], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 410)], $xs->getSubscriptions());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:13,代碼來源:ThrottleTest.php

示例14: generator_throws_error

 /**
  * @test
  */
 public function generator_throws_error()
 {
     $error = new \Exception();
     $generator = $this->genError($error);
     $xs = new \Rx\Observable\IteratorObservable($generator);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs;
     });
     $this->assertMessages([onError(201, $error)], $results->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:13,代碼來源:IteratorObservableTest.php

示例15: testToArrayError

 public function testToArrayError()
 {
     $error = new \Exception();
     $xs = $this->createHotObservable([onNext(110, 1), onNext(220, 2), onNext(330, 3), onNext(440, 4), onNext(550, 5), onError(660, $error)]);
     /** @var MockObserver $results */
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->toArray();
     });
     $this->assertMessages([onError(660, $error)], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 660)], $xs->getSubscriptions());
 }
開發者ID:bluetechy,項目名稱:Rx.PHP,代碼行數:11,代碼來源:ToArrayTest.php


注:本文中的onError函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。