objectbox-java icon indicating copy to clipboard operation
objectbox-java copied to clipboard

LiveData query subscription swallows query exceptions

Open tvvbbb opened this issue 6 years ago • 8 comments

When I use arch(LiveData), I found no exception trigged with no empty constructor. But build a query and invoke find() will trigger the exception.

tvvbbb avatar Jul 19 '18 08:07 tvvbbb

@tvvbbb Could you please post the exception stack trace? Thank you!

greenrobot avatar Jul 19 '18 08:07 greenrobot

If I use LiveData, it is no exception. So I can't realize no empty constructor is wrong. But if I only use query().find(), it will make the exception.

tvvbbb avatar Jul 20 '18 04:07 tvvbbb

If I understand this correctly, the issue is that a DataSubscription used by ObjectBoxLiveData might swallow exceptions that occured while running a query.

~There is a note in SubscriptionBuilder.ActionObserver.callOnError() (link might stop working with new releases, as I can not link to a tagged version) about this. It was added with 882a2043c13b52f67d424f98bca8930c14436a5d.~

~There is SubscriptionBuilder.onError() to explicitly set an error observer. Maybe we can implement it and throw the exception there?~ -ut

greenrobot-team avatar Jul 23 '18 12:07 greenrobot-team

Could confirm this using the arch example project (added a ToOne relation to Note, made fields private).

Upon further investigation it turns out QueryPublisher.publishSingle() swallows any exceptions from query.find(). -ut

greenrobot-team avatar Jul 23 '18 13:07 greenrobot-team

I am so sorry for my poor English. I am not sure to get what you mean actually. https://github.com/tvvbbb/ObjectBoxLiveDataSwallowsException. Comment in MainActivity.

tvvbbb avatar Jul 24 '18 04:07 tvvbbb

I am sorry for my wrong operation, repository commit failed. Now is successful.

tvvbbb avatar Jul 24 '18 07:07 tvvbbb

@tvvbbb OK, so I understood correctly (for me: see my previous comment). Thanks! -ut

greenrobot-team avatar Jul 24 '18 08:07 greenrobot-team

Is it a bug?

tvvbbb avatar Jul 24 '18 09:07 tvvbbb