-1

I am making a rest call using apache cxf . I am able to set timeout during invoking a service and corresponding socketConnection timeout exception gets thrown but i am not able to catch the exception and set it as user definied exception. Please find the below code for time out exception

try{
    HTTPClientPolicy clientConfig = WebClient.getConfig(service).getHttpConduit().getClient(); clientConfig.setReceiveTimeout(10000);} 
catch(SocketTimeOutException e) {
          logger.error("");
         CustomException....
    }

Exception gets thrown without going inside catch block. Could someone tell me how can i catch this exception?

user6543599
  • 541
  • 2
  • 8
  • 18

1 Answers1

0

try to write

catch(Exception e) {
      logger.error("");
     CustomException....
}

instead of your code. Then you can catch the exception and handle it.

Kenster
  • 23,465
  • 21
  • 80
  • 106