Figure out why BriteDatabaseTest.badQueryCallsError crashes the process
JakeWharton opened this issue · 3 comments
JakeWharton commented
Figure out why BriteDatabaseTest.badQueryCallsError crashes the process
SiimKinks commented
The SQLiteException is thrown when Query#run
is called in RecordingObserver#onNext
, but this is not allowed in RxJava2 since it's not a fatal exception, which results in process death.
JakeWharton commented
Yeah we should be trapping this and forwarding to onError. Malformed SQL
should be sent through the normal error-handling pipeline.
…On Sat, Jun 10, 2017, 1:22 PM Siim Kinks ***@***.***> wrote:
The SQLiteException is thrown when Query#run is called in
RecordingObserver#onNext, but this is not allowed in RxJava2 since it's
not a fatal exception, which results in process death.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#185 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEW-AhUj4ApTcLMppJQ7DzGvFFzi3ks5sCtDYgaJpZM4Nvcg1>
.
SiimKinks commented
I don't see any actions to take here, since this particular case is a consumer problem.
Exception is handled correctly when used in operators:
@Test public void badQueryCallsErrorInOperator() {
TestObserver<Employee> o = db.createQuery(TABLE_EMPLOYEE, "SELECT * FROM missing")
.mapToOne(Employee.MAPPER)
.test();
o.awaitTerminalEvent();
final List<Throwable> errors = o.errors();
assertThat(errors).hasSize(1);
assertThat(errors.get(0).getMessage()).contains("no such table: missing");
}
Only thing we could do is inform users to use safeSubscribe
as described in What's-different-in-2.0#leaving-the-reactive-world
@Test public void badQueryCallsError() {
db.createQuery(TABLE_EMPLOYEE, "SELECT * FROM missing").safeSubscribe(o);
o.assertErrorContains("no such table: missing");
}