| 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 | 29 | super("Server process terminated unexpectedly with exitvalue: " + rc, extractRealCause(cause)); |
| 11 | 29 | this.exitValue = rc; |
| 12 | 29 | } |
| 13 | |
|
| 14 | |
private static Throwable extractRealCause(Throwable cause) { |
| 15 | 29 | if (cause instanceof RuntimeIOException) { |
| 16 | 0 | return cause.getCause(); |
| 17 | |
} |
| 18 | 29 | return cause; |
| 19 | |
} |
| 20 | |
|
| 21 | |
public int getExitValue() { |
| 22 | 1 | return exitValue; |
| 23 | |
} |
| 24 | |
|
| 25 | |
} |