Luiz Henrique wrote:

> we are sharing the same ideas about how and in what kind of condition 
> should be showed error messages. Btw, I'm using ACRA to handle uncaught 
> exception and it have worked fine. 
>

"ACRA"?
 

>
> About catch-exception you understand me well. So, nowadays I'm using 
> try/catch to grab the exceptions and sometimes there is a bunch of "dirty" 
> code just to handle exceptions. I would like to know is there is some 
> approach in android [sic] to handle in an unique Class/Method 
> catch-exceptions. For example, something we can do using interceptors/AOP 
> for others applications?
>

Why would you call that code "dirty"?

Is code that handles bad conditions somehow inferior to code that handles 
the happy path?
I'm inclined to think the exact opposite.

Much more likely to be good engineering than "interceptors/AOP" (huh?) 
would be good refactoring 
of your code. Dealing with exceptions is not an Android issue but a 
programming issue, and you 
need to fully understand what exceptions are and how they fit strategically.

The boilerplate for exceptions can be verbose, but hey, at least you don't 
actually have to work 
for a living. The worst you can fear from it is a slight increase in 
callous on your fingertips.

You reduce verbosity by isolating checked-exception handling to the 
lower-level routines. One 
standard (not necessarily best-practice) technique is to rethrow as a 
custom exception (checked 
or unchecked) which is handled by the top controller level in a 
user-friendly way. The lower-level
routines do something pretty specific, say, open a resource, and eat all 
the checked exceptions 
that might engender, replacing them with defaults, custom exceptions or 
navigation, error return 
values, or whatever your strategy dictates. 

By relegating verbose exception handling to lower-level routines, the 
higher-level ones read 
much more like happy-path laconic self-documenting scripts.

What do you mean by "others applications"?

-- 
Lew

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to