What I Hate About Your Programming Language
Subject:   Java + Exceptions
Date:   2003-05-15 22:25:54
From:   anonymous2
Response to: Java + Exceptions

What the other guy wants is supported in other languages. I won't tell you which as you might criticize the language just because of that:). There are cases that you may just want to ignore an exception. The language I know well just has you 'flick a switch' before executing the code and that code will run just as it would have executed OK even though the results may vary.

Basically the switch stops any (or most) errors from percolating from the system into your function. Some systems are very explicit with their messages so I may have to catch say 20 exception messages to have the function 'continu'.

Another ''envvar'' may later be tested if something went wrong indeed if you want to - and did not reuse that ''envvar''.

So if I open a file - which can go wrong for maybe a hundred reasons with a dozen error codes on this system - a can flick the switch and later test whether it was successful or not - which is the only thing I am interested in. (In this case I am still handling the exception, I know.)

This is obviously not Java, but it makes me understand the question.