> // 'bad' orders have no start cpu's and cause the order lookup to > fail. > if (guest.getStartCpus() < 1) > return null; > - ProductOrder order = > client.getVirtualGuestClient().getOrderTemplate(guest.getId()); > + try { > + order = > client.getVirtualGuestClient().getOrderTemplate(guest.getId()); > + } catch (RuntimeException e) { > + // this is a workaround because SoftLayer throws somethimes 500 > internal server errors for the above method call > + logger.warn("Cannot getOrderTemplate " + guest.getId(), e); > + return null;
Since order == null triggers a return just one command later, make this `order = null` instead? This might also make it clearer that `null` is indeed a possible "normal" response for getOrderTemplate, even if no exception is thrown? To @nacx's comments: is there some way we can at least verify that `e` is the "expected" RuntimeException here? Can we * catch a narrower category or exceptions and * check for the code, body or message somehow ? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/199/files#r7579866