Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Lourdes Edwards   on Jul 23 In Java Category.

  
Question Answered By: Devrim Yilmaz   on Jul 23

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 );
}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Exception handling Or get search suggestion and latest updates.


Tagged: