View Javadoc

1   package com.aragost.javahg.internals;
2   
3   
4   /**
5    * Exception thrown when during parsing of the output from command
6    * server, some unexpected output is encountered.
7    * <p>
8    * It means that Mercurial generated output that JavaHg didn't
9    * anticipate. If this exception is throw it generally means there is a
10   * bug in JavaHg.
11   */
12  public class UnexpectedCommandOutputException extends RuntimeException {
13  
14      private static final long serialVersionUID = 1L;
15  
16      public UnexpectedCommandOutputException(AbstractCommand command, String s) {
17          super(createMessage(command, s));
18      }
19  
20      public UnexpectedCommandOutputException(String msg) {
21          super(msg);
22      }
23  
24      private static String createMessage(AbstractCommand command, String s) {
25          StringBuilder builder = new StringBuilder();
26          builder.append("Unexpected output from: ").append(command);
27          if (s != null) {
28              builder.append(" [").append(s).append(']');
29          }
30          return builder.toString();
31      }
32  
33  }