throw with String

Ralf Ebert ralf at ralfebert.de
Thu Sep 16 01:25:39 PDT 2010


> Isn't this a java.lang.Error:
> 
> "An Error is a subclass of Throwable that indicates serious problems
> that a reasonable application should not try to catch."

imho "serious" means "JVM almost dying", I was thinking more about
casual, unserious errors like:

throw new RuntimeException("You can specify a width in pixel OR in
percent, but not both!");
throw new RuntimeException("setFoo() requires bar.");
throw new RuntimeException("Value cannot be set because of null value in
nested property 'foo'!");

(these are cases from a library I'm writing where I'm very sure than an
application developer is misusing the library when trying to catch one
of these exceptions specifically)

Ralf




More information about the coin-dev mailing list