Пример #1
0
  public void onException(ErrorMessage msg) throws MuleException {
    Class eClass = null;
    ExceptionHandler eh = null;

    try {
      eClass = msg.getException().toException().getClass();
      eh = getHandler(eClass);
      eh.onException(msg);
    } catch (Exception e) {
      logger.error(e);

      if (eh instanceof DefaultHandler) {
        logger.error(LocaleMessage.defaultFatalHandling(FatalHandler.class));
        handleFatal(e);

      } else if (eh instanceof FatalHandler) {
        logger.fatal(LocaleMessage.fatalHandling(e));
        MuleServer.getMuleContext().dispose();
        System.exit(-1);
      } else {
        logger.error(LocaleMessage.defaultHandling(DefaultHandler.class, eh, e));
        handleDefault(msg, e);
      }
    }
  }
Пример #2
0
 private void handleDefault(ErrorMessage msg, Throwable t) {
   ErrorMessage nestedMsg = null;
   // Try wrapping the exception and the Exception message that caused the
   // exception in a new message
   try {
     nestedMsg = new ErrorMessage(t);
   } catch (Exception e) {
     logger.fatal(LocaleMessage.defaultException(e), e);
     handleFatal(e);
   }
   try {
     defaultHandler.onException(nestedMsg);
   } catch (HandlerException e) {
     logger.fatal(LocaleMessage.defaultHandlerException(e), e);
     handleFatal(e);
   }
 }