}
}
if (jmsExceptionListenerCopy != null)
{
JMSException jmsException = null;
if (throwable instanceof Error)
{
final String msg = "Caught Error on underlying remoting connection";
log.error(this + ": " + msg, throwable);
jmsException = new JMSException(msg + ": " + throwable.getMessage());
}
else if (throwable instanceof Exception)
{
Exception e = (Exception)throwable;
jmsException = new JMSException("Failure on underlying remoting connection");
jmsException.setLinkedException(e);
}
else
{
// Some other Throwable subclass
final String msg = "Caught Throwable on underlying remoting connection";
log.error(this + ": " + msg, throwable);
jmsException = new JMSException(msg + ": " + throwable.getMessage());
}
jmsExceptionListenerCopy.onException(jmsException);
}
}