On 30/07/2013, at 7:43 PM, Quincey Morris <quinceymor...@rivergatesoftware.com> 
wrote:

> On Jul 30, 2013, at 10:26 , Graham Cox <graham....@bigpond.com> wrote:
> 
>> How often have you encountered an unexpected exception from some low-level 
>> code you don't own under circumstances you can't control? If your app 
>> crashed every time you'd soon have a reputation for unreliability that is in 
>> all probability undeserved. On balance it's better to carry on with some 
>> minor glitch than "quit unexpectedly".
> 
> Surely the problem with this perspective is that the uncaught exception 
> results in an abrupt transfer of control from the point of the exception back 
> to (approximately) [NSApplication sendEvent:]?
> 
> If you don't own the low-level code where the exception was thrown, you can 
> have no confidence that non-stack data structures being maintained by that 
> code -- along with all of the intermediate levels of calling code -- are in 
> any usable state.
> 


I totally agree - from the point of view of a developer.

However, from the point of view of a) the user and b) the director of a company 
making and selling apps, it's not what you want to happen. Any crash is 
unacceptable - it makes the app look flaky and the user will lose faith in it 
and probably lose their data too. The vast majority of exceptions in practice 
are benign - much better to effectively ignore them and continue as best you 
can (which is very often with 100% functionality) than crash. If there are 
cases that come up that can be handled better, then those handlers can be added 
in later.

As an example, I had one recently where under very specific circumstances, the 
user could end up pushing the code into inverting a transform that had no 
inverse, e.g. a divide by zero. The Core Graphics framework throws an exception 
if you do that, but the specific circumstances had not been caught in testing 
because it was such a weird corner case. If my app crashed at that point, it 
would look very serious indeed, whereas the actual outcome for the user was a 
very minor graphical glitch. I now add a handler for that case that puts things 
back in a good state, but simply ignoring the original exception wasn't a 
disaster either.

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to