public function distinct_CustomKey_some_throw()
{
$error = new \Exception();
$xs = $this->createHotObservable([onNext(280, ['id' => 4]), onNext(300, ['id' => 2]), onNext(350, ['id' => 4]), onNext(380, ['id' => 3]), onNext(400, ['id' => 3]), onCompleted(420)]);
$results = $this->scheduler->startWithCreate(function () use($xs, $error) {
return $xs->distinctKey(function ($x) use($error) {
if ($x['id'] === 3) {
throw $error;
}
return $x['id'];
})->map(function ($x) {
return $x['id'];
});
});
$this->assertMessages([onNext(280, 4), onNext(300, 2), onError(380, $error)], $results->getMessages());
$this->assertSubscriptions([subscribe(200, 380)], $xs->getSubscriptions());
}