-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Propagate exceptions on @Background/@UIThread annotated methods #677
Propagate exceptions on @Background/@UIThread annotated methods #677
Conversation
The main goal of this fix is to avoid hiding exception to ExceptionHandler.
Propagate exceptions on @Background/@UIThread annotated methods
|
👍 |
|
Why are we catching the exception to throw it just after ? And because we throw an unchecked exception, we don't have to log it since it will be logged by the system if the dev doesn't catch it. |
|
I asked myself the same question and finally decided to change as little as possible. If people were used to check the log to see exceptions in their threads... But maybe I'm wrong. |
|
If a dev switches to 3.0 and doesn't change anything, the exception will be logged twice. Once by AA, once by the system since it's an unchecked exception. |
|
I agree. We should fix that |
|
Ok I will remove the try/catch then. |
|
@DayS @yDelouis With the new So since I removed the try/catch and the log, exceptions in a runnable are completely invisible... |
|
I tested this feature on a Sandbox project and it worked fine. That's strange. I'm gonna test it again, so. |
|
Did you manage to reproduce the problem ? Me, yes. When you use the I found 2 ways to fix the issue, but both have drawbacks. Solution 1 : never use Solution 2
8000
: override |
|
I did manage to reproduce this problem. And I had the solution 1 in my mind... But it's not the best solution... |
|
Ok I found a solution with I think no major drawbacks. The tip is to call For that I created another thread pool in Please check that commit tbruyelle/androidannotations@86d89d27 and if the tip is acceptable for you, then I will make a PR. |
Related to #646
Instead of only logging the exceptions thrown in
@Background/@UIThreadblocks, which make them invisibles to exception handlers, a decision has been made to propagate them.Requires a big warning in the 3.0 change log 😄
The generated code :