- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Is there any way to not duplicate that everywhere?
I'm thinking something like (pseudocode)
function interpretError(Exception ex) { try { throw ex } catch (UnknownHostException uhe) { // show user nice message } catch (NoRouteToHostException nrthe) { // show user nice message } catch (ConnectionException ce) { // show user nice message } catch (IOException ioe) { // something else } }
Admin
drop the www
http://thedailywtf.com still redirects
Admin
This has nothing to do with Java's exception set up. Since you can create your own exception types, you can pass any information you want back with the exception, including useful error messages.
Now it's possible that the error is coming from some library that refuses to give you useful information, but that's not the fault of exceptions in general.
Admin
how about:
private void disambiguateException(IOException ioe) { if (ioe instanceOf UnknownHostException) System.out.println("You are dump and mispelled the URL"); ... etc. }
No need to rethrow
Admin
That was meant to be a reply to Random's question about encapsulating the exeception handling.
Admin
Guess this will only confuse the user more... :P
Admin
Maybe you are dump and spelled 'dump' wrong. No? Ok, was worth a try though.
Admin
Hilarious.
But these SMTP exchanges are a bit more famous:
220-NIC.DDN.MIL SMTP Service 6.1 at Fri, 26 Jul 91 18:21:06 PDT 220 Don't Worry. helo nonesuch.noao.edu 250 NIC.DDN.MIL - Never heard of that name, bordeaux.kpno.noao.edu helo cc.utah.edu 250 NIC.DDN.MIL - You are a charlatan, bordeaux.kpno.noao.edu quit 221 NIC.DDN.MIL -- Be Happy!
And, of course...
220 deskpro.sow.econ.vu.nl Server SMTP (Complaints/bugs to: postmaster) helo foo.bar 250 deskpro.sow.econ.vu.nl - Liar, Liar! Pants on Fire! quit 221 deskpro.sow.econ.vu.nl says goodbye to kappl.cs.vu.nl at Tue Jul 30 22:13:43.
(From the really old file.) Just to show that messing with protocol-level response messages is a time-honoured tradition that persists even to this day. =)
Admin
In live code where I work, I've come across an event handler for Application Domain Unhandled Exception (whatever the default name VS05 gives such a thing) which does the following: System.Console.Out.WriteLine("I am sad")
I've never seen it happen though, as there's other things that seem to take care of any unhandled exceptions.
Admin
My all-time favorite error mesage was from an old Mac version of Eudora. One day I was typing alng without looking at the screen and hadn't noticed that all of the Eudora windows were closed. Eudora noticed however and came up with the pithy comment "You Might As Well Stop Typing Because Nobody is Listening".
Wonderfully insulting.
Admin
this happened to our lil' softhouse once, some smartass code monkey (who got fired for incompetence later) wrote on one error window: "a really terrible error has occurred, call the firefighters!" that mofu...
Admin
I blogged about this a recent encounter with exactly this type of message - on my tiny little cell phone screen, of all places:
http://moblog1389.blogspot.com/2007/04/oops-that-wasnt-supposed-to-happen-c.html
Captcha: gotcha (yep!)
Admin
LOL...good one!
Admin
No need for names - Dump is valid... haven't you ever taken a dump?
Award yourself a dump for being mean, turd.
Admin
prednisone 20mg online: https://prednisone1st.store/# prednisone 30