code: public void setMessageException(Throwable ex)
      {
          String strErrorMessage = ex.getMessage();
          BaseMessage message = this.getMessage();
          if ((message != null) && (message.getMessageHeader() instanceof TrxMessageHeader))
              ((TrxMessageHeader)message.getMessageHeader()).put(TrxMessageHeader.MESSAGE_ERROR, strErrorMessage);
          else
              ex.printStackTrace();
      }
docs: If an exception occurred, set it in the message
  @param ex