当前位置: 首页>>代码示例>>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;未经允许,请勿转载。