Hi all, how is everyone handling exceptions. I am trying to implement a good exception handling i.e layer conformed exceptions-- meaning each layer will handle a specific exception at a layer and escalate it to the client. For ex:
1. class Data
public
String [] readRecord(long recNo) throws RNF -- GIVEN BY SUN
2. class DataAdapter
public String [] readRecord(long recNo) throws RNF, RemoteException{
Data.readRecord(recNo);
}
3. class Remote(RMI)
public String [] readRecord(long recNo) throws RemoteException{
DataAdapter.readRecord(recNo);
}
4. Client
Client.readRecord(2);
public String [] readRecord(long recNo) throws ClientControllerException {
try{ Remote.readRecord(recNo)
}catch (RNF r)
throw new ClientControllerException(r)
}catch (RemoteException re){
throw new ClientControllerException(re)
}
2 will "only" "catch" rnf and throw new RNF()
3 will "only" catch RemoteException and throw new RemoteException()
4 Client will catch the RNF exceptions and RemoteExceptions thrown in
2 and 3, warp those excpetions in a customized ClientControllerException--> not sure how do this yet, getting errors when I am wrapping the exceptions.
All will be checked exceptions and will be escalated to the client. Is this the proper approach by catching layer specific exceptions at a certain level and escating them to the client