Is it a bad practice to catch Throwable?For example my code something like this.But in sonar its showing as bug .How can we resolve this
code
try {
return restTemplate.getForObject(urlSearchID, AccessIDSearchResponse.class);
} catch (HttpServerErrorException hse) {
AccesIdExceptionUtility.recoverFromHttpServerExc(hse);
} catch (HttpClientErrorException hce) {
AccesIdExceptionUtility.recoverFromHttpClientExc(hce);
} catch (ClientException ce) {
AccesIdExceptionUtility.recoverFromClientExc(ce);
} catch (Exception e) {
AccesIdExceptionUtility.recoverFromException(e);
}
catch (Throwable ex) {
throw new ServiceException(ErrorMessages.EPO_SYSTEM_ERROR, ex.getMessage(), agentSearchUrl);
}
return null;