Hello there,

is it possible to create an exception which will *not* be caught by a general 
handler, only by a specific one? So that e.g., the following code

class MySpecialException extends Exception { /* whatever magic needed here */ }
def foo() {
  throw new MySpecialException()
def bar() {
  try {
  } catch (exception) {
    println "bar caught $exception"
static main(args) {
  try {
  } catch (MySpecialException special) {
    println "special exception"

would print out "special exception" and *not* "bar caught..."?

The reason is that the code I at the moment work with contains _lots_ of 
generic try/catch harnesses at different levels of code; they generally report 
the error caught and then go on processing the input. Now I would need a 
„special” exception which would not be caught by any of them, to abort the 
processing immediately.

Adding a separate "catch (MySpecialException goup) { throw goup }" statement to 
each of all those already existing harnesses -- which would be, I guess, 
conceptually the right thing to do -- would be rather at the inconvenient side.


Reply via email to