Thursday, June 19, 2014

Error propagation from one layer to another layer

ServiceInterface {
public Users checkClient(Dto dto) throws Exception;

}

Controller{
try {
// call service
Interface x;
 x.checkClient(..)
}

 catch (Exception ex) {

// this error is thrown from another layer that is called from controller .I.e in this case from serviceImpl
//get the message ApplicationException("invalid username or password");
setErrMsg(ex.getMessage());


}


Public class ServiceImpl implements ServiceInterface

{
public Users checkClient(Dto dto) throws Exception{


throw any exception here// like that is cheked one relating to some business operation
throw new ApplicationException("invalid username or password");





}



}

No comments:

Post a Comment