U can use it in following structure:
ParentException : which extends Exception, and is also abstract and have an abstract method it can be called translateException().
DataTierException : which extends ParentException, so it supposed to implement translateException method, it's would be implemented like this:
translateException( Exception ex ){
if ( ex instanceof Nullpointer )
throw new DataTierException( SpecificErrorCode )
BusinessTierException : which extends ParentException, so it supposed to implement translateException method, it's would be implemented like this:
translateException( Exception ex ){
if ( ex instanceof Nullpointer )
throw new BusinessTierException ( SpecificErrorCode )
WebTierException : which extends ParentException, so it supposed to implement translateException method, it's would be implemented like this:
translateException( Exception ex ){
if ( ex instanceof Nullpointer )
throw new WebTierException ( SpecificErrorCode )
So in each tier can be like this:
try{
// do sth here
DataTier.methodCall();
}catch( DataTierException ex )
{
throw businessException.translateException( ex );
}