public final void handleException(Throwable tr, String processName, PluginContext ctx)
throws MessagingNetworkException
{
if (Defines.DEBUG && CAT.isEnabledFor(org.apache.log4j.Level.ERROR)) CAT.error("error while "+processName, tr);
MessagingNetworkException ex;
if (tr instanceof MessagingNetworkException)
{
ex = (MessagingNetworkException) tr;
}
else
if (tr instanceof UnknownHostException)
ex = new MessagingNetworkException(
"DNS error resolving "+tr.getMessage(),
MessagingNetworkException.CATEGORY_LOGGED_OFF_DUE_TO_NETWORK_ERROR,
MessagingNetworkException.ENDUSER_LOGGED_OFF_DUE_TO_NETWORK_ERROR);
else
if (tr instanceof InterruptedIOException)
ex = new MessagingNetworkException(
"mim admin restarts the mim server.",
MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN,
MessagingNetworkException.ENDUSER_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN);
else
if (tr instanceof InterruptedException)
ex = new MessagingNetworkException(
"mim admin restarts the mim server.",
MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN,
MessagingNetworkException.ENDUSER_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN);
else
if (tr instanceof IOException)
ex = new MessagingNetworkException(
"I/O error: "+tr.getMessage(),
MessagingNetworkException.CATEGORY_LOGGED_OFF_DUE_TO_NETWORK_ERROR,
MessagingNetworkException.ENDUSER_LOGGED_OFF_DUE_TO_NETWORK_ERROR);
else
if (tr instanceof AssertException)
ex = new MessagingNetworkException(
"bug found: "+tr.getMessage(),
MessagingNetworkException.CATEGORY_NOT_CATEGORIZED,
MessagingNetworkException.ENDUSER_MIM_BUG);
else
ex = new MessagingNetworkException(
"unknown error: "+tr.getMessage(),
MessagingNetworkException.CATEGORY_NOT_CATEGORIZED,
MessagingNetworkException.ENDUSER_MIM_BUG_UNKNOWN_ERROR);
if (ex.getLogger() != MessagingNetworkException.CATEGORY_STILL_CONNECTED)
{
setLastError(ex);
shutdown(ctx, lastError.getLogger(), lastError.getMessage(), lastError.getEndUserReasonCode());
}
throw new MessagingNetworkException(
"Error while " + processName + ": " + ex.getMessage(),
ex.getLogger(),
ex.getEndUserReasonCode());
}