Thu, 26 Mar 2009 00:29:44 +0100, Saaa wrote: > I filled in the Phobos implementation, but I'm not sure if it is all correct > as I don't fully understand the exception handling. > > [...] > > catch( IllegalArgumentException e ){ > //How does this work? It catches e and gives it as an argument to a new > exception. > throw new NumberFormatException( e ); > }
Obviously NumberFormatException can store another exception object inside. This code effectively converts IllegalArgumentException into NumberFormatException, storing the original argument exception inside so that one can examine it later if they're curious. > [...] > > catch(Object e){ // ConvError or ConvOverflowError > //Is this the correct translation? > throw new NumberFormatException( e ); > } It depends on what NumberFormatException can accept as an argument. If it accepts an Object then it's fine.