Re: Try/Catch

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...

But let's say it failed and your code actually got control at the point of failure ... what sensible thing can your program do to carry on?

Sometimes crashing is the right thing to do. But if a feature of a big program breaks for some reason (let's assume user input that you didn't anticipate, because that's super common) that doesn't mean the whole thing should die. It might be possible to carry on with other aspects.

Here's a real life example I run into every day. In my day job, I work with a java project that uses JSF / xhtml markup for building web pages. I use Eclipse. Many of my files include other files. I can select an include statement, hit F3 and have the included file opened in the editor. For some reason, every time I do this, I get a dialog pop up and tell me that there was a NullPointerException. But I can click OK and get on with my job.

It's a bit annoying, and obviously someone has done something wrong here. I've never dug too deeply, but I assume it was the extension / plugin writer who wrote the xhtml stuff. I guess I could find another tool to use or try upgrading or whatever. Or at least report the bug. But...meh...I have better things to do (like get my work done) and at least I can keep working, and whatever that error was, it wasn't critical and was definitely recoverable, though it's a class of error that euphoria would crash upon.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu