001    package edu.harvard.deas.hyperenc;
002    
003    /**
004     * Thrown when the parsing of a message fails. The message that triggered the
005     * exception (by virtue of containing some error) is included, and accessible
006     * via the <code>getErroneousMessage</code> message.
007     */
008    public class MessageParseException extends Exception {
009      private static final long serialVersionUID = 1L;
010      
011      private String erroneousMessage;
012      
013      /**
014       * Constructs a new MessageParseException with the given detail message.
015       * @param message the detail message
016       * @param erroneousMessage the message that triggered the exception
017       */
018      public MessageParseException(String message, String erroneousMessage) {
019        super(message);
020        this.erroneousMessage = erroneousMessage;
021      }
022    
023      /**
024       * Constructs a new MessageParseException with the given detail message.
025       * 
026       * @param message
027       *        the detail message
028       * @param erroneousMessage
029       *        the message that triggered the exception
030       * @param cause
031       *        the cause (A null value is permitted, and indicates that the cause
032       *        is nonexistent or unknown.)
033       */
034      public MessageParseException(String message, String erroneousMessage, Throwable cause) {
035        super(message, cause);
036        this.erroneousMessage = erroneousMessage;
037      }
038      
039      /**
040       * Returns the message that triggered this exception.
041       * @return the message that triggered this exception
042       */
043      public String getErroneousMessage() {
044        return erroneousMessage;
045      }
046    }