Erro handeling is always a chalange in any development enviroment.
In general, we will never spot an error if we log or catch. Only developers will see those, and if you're muffling to avoid user-visible behavior, succeeding means nobody will notice!
I am a huge fan of open source Firefox iOS Developed in Swift and consider it as an inspiration.
I found the following discussion on bugzilla
Inspired by buzilla form -
https://mail.mozilla.org/pipermail/mobile-firefox-dev/2015-August/001451.html
In general, we will never spot an error if we log or catch. Only developers will see those, and if you're muffling to avoid user-visible behavior, succeeding means nobody will notice!
So our guideline is:
"if it's something wrong that we want to fix, let it crash, find and fix before release. "
If it's something wrong that might seriously impact the user experience, or is not indicative of a programming error, then muffle but make sure we have a test or some other way to find the problem.
Or make sure that failure propagates around the application through some other kind of logic — return values, fall through, whatever.
Also: if you write 'catch Exception', consider writing 'Throwable' instead. I often see this:
// This might run out of memory.
catch (Exception e) {
which won't work — Exception and Error are siblings, and OOMs are OutOfMemoryErrors. That'll catch everything but an Error!
I found the following discussion on bugzilla
Inspired by buzilla form -
Richard Newman |
Bugzilla - https://bugzilla.mozilla.org/show_bug.cgi?id=1191067#c25
Github - https://github.com/mozilla/firefox-ios
No comments:
Post a Comment