1 package com.aragost.javahg.internals;
2
3 public class UnexpectedServerTerminationException extends RuntimeException {
4
5 private static final long serialVersionUID = 1L;
6
7 private final int exitValue;
8
9 public UnexpectedServerTerminationException(int rc, Throwable cause) {
10 super("Server process terminated unexpectedly with exitvalue: " + rc, extractRealCause(cause));
11 this.exitValue = rc;
12 }
13
14 private static Throwable extractRealCause(Throwable cause) {
15 if (cause instanceof RuntimeIOException) {
16 return cause.getCause();
17 }
18 return cause;
19 }
20
21 public int getExitValue() {
22 return exitValue;
23 }
24
25 }