commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Caswell" <ste...@caswell.name>
Subject RE: [lang] Some suggested exception additions.
Date Sun, 11 May 2003 13:09:09 GMT
These all look interesting to me. If there are no objections from others,
I'll be happy to commit them if you'd like to submit them. Please include
the Apache license stuff at the top of the sources. Simple test cases would
also be welcome, as well as javadocs.


Steven Caswell
steven@caswell.name
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: _matthewHawthorne [mailto:mhawthorne@alumni.pitt.edu] 
> Sent: Saturday, May 10, 2003 7:31 PM
> To: Jakarta Commons Developers List
> Subject: [lang] Some suggested exception additions.
> 
> 
> I use the following exceptions frequently, is there any 
> interest in including them in [lang]?
> 
> ================================
> 
> - IllegalClassException
> 	Thrown when an object is an instance of an unexpected class.
> 
> 	Useful for implementations of interfaces that specify Object as
> 	parameter type, but require a more specific class.
> 
> 	constructor:
> 	IllegalClassException(Class expected, Class found)
> 
> - IncompleteArgumentException 	
> 	Thrown to indicate an incomplete argument to a method.
> 
> - NotImplementedException 
> (extends java.lang.UnsupportedOperationException)	
> 	
> 	Thrown to indicate that a method has not been implemented.  
> 
> 	Useful because it informs the caller of the 
> implementation 	class, if
> it is not directly known.
> 
> 	constructor:
> 	NotImplementedException(Class clazz)
> 
> - NullArgumentException (extends java.lang.IllegalArgumentException)
> 	Thrown to indicate that a method argument was null and 
> should 	not have
> been.
> 
> 	constructor:
> 	NullArgumentException(String argName)
> 
> - UnhandledException (extends NestableRuntimeException)
> 	Generic nestable wrapper, useful when a checked 
> Exception is 	consumed
> and thrown as a RuntimeException
> 
> 	constructor:
> 	UnhandledException(Throwable cause)
> 
> ================================
> 
> One of the main benefits is the elimination of writing 
> repetitive error messages
> 
> for example:
> 	throw new IllegalArgumentException("xxx cannot be null") becomes
> 	throw new NullArgumentException("xxx");
> 
> 
> Any suggestions or thoughts?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message