On Tue, Mar 24, 2009 at 8:12 AM, mike quinn <[email protected]> wrote:
> Stoyan, yes you should wrap your code up in exception handling.

Look, take for example the copy protection bug, which screwed
permissions on application update and the app can't access its own
files anymore.

>
> 1) it will provide a better experience for your end users with a meaningful
> error message.

It's going to be ONE message only - "Can't access application data
because Google has screwed the permissions."

>
> 2) it will make it easier for you to find out where and why the error
> occurred if you log any exceptions.

Now here's the tricky part - if the update screwed the permissions,
where do I log? I can't log to file in the app's private dir, so I
guess I could log to the SD card or try to publish the exception
stacktrace online. The former requires that the application handles
logging to 2 places, and the later have 1 more permission, and to log
to 3 places, because the user might not have internet connection, or
she might have removed the SD card. In this case, perhaps I should log
to a 4th place - the clipboard, and ask her to send me an e-mail when
she can and paste me the error.

When finally the stack trace comes to me, it will be invaluable, but
ONLY if the bug was mine and I haven't tested my code.
The hassle is too big for what would turn out to be an Android bug
because I'm not rushing apps, especially looking at what sales look
like...

>
> 3) would mean you could implement some kind of retry strategy where
> appropriate, such as when reading from a file, connecting to a database etc.

I do handle the cases, where the app tries to store or retrieve data
and it's expected that the media could fail.

I don't handle the cases, where the app can't access its own assets,
resources or app-private files.
There's no way you can't read a file in your app-private directory
(e.g. the settings), right? The only reasons not to are:
- screwed permissions - in which case it's Android bug, or the user
has a rooted phone and did something, for which I could care less
- gone out of memory - for which I've coded carefully not to hit, and
when I do, there's nothing I can do

>
> Java makes it so easy to perform exception handling with try/catch you'd be
> mad not to take advantage of it.

Catching exceptions you expect is one thing, and I do it. Catching
such exceptional exceptions (as screwed permissions) to me is like
trying to divide to a number, known to be > 0, but you catch the
DivideByZeroException just in case a bit flips because of some
magnetic or alien forces and it becomes 0.

Cheers

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Discuss" 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-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to