objectbox-java
objectbox-java copied to clipboard
LiveData query subscription swallows query exceptions
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 Could you please post the exception stack trace? Thank you!
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.
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
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
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.
I am sorry for my wrong operation, repository commit failed. Now is successful.
@tvvbbb OK, so I understood correctly (for me: see my previous comment). Thanks! -ut
Is it a bug?