One option:
... // somewhere inside a method...
final ApnsClient apnsClient;
{
try {
apnsClient = receiveApnsConnection(...);
} catch (IllegalArgumentException iae) {
logger.error(iae.getMessage(), iae);
senderCallback.onError(String.format("Unable to connect to APNs (%s))", iae.getMessage()));
return; // adios !
}
}
versus this one:
... // in some methods....
final ApnsClient apnsClient;
try {
apnsClient = receiveApnsConnection(...);
} catch (IllegalArgumentException iae) {
logger.error(iae.getMessage(), iae);
senderCallback.onError(String.format("Unable to connect to APNs (%s))", iae.getMessage()));
return; // adios!
}
for some reason I do find the first one a bit more readable, due to the strcuted {}
block