| 1 | |
package org.webslinger; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
|
| 5 | |
public class WebslingerException extends IOException { |
| 6 | |
public WebslingerException(String msg) { |
| 7 | 0 | super(msg); |
| 8 | 0 | } |
| 9 | |
|
| 10 | |
public WebslingerException(String msg, Throwable cause) { |
| 11 | 0 | super(buildMessage(msg, cause)); |
| 12 | 0 | initCause(cause.getCause() != null ? cause.getCause() : cause); |
| 13 | 0 | } |
| 14 | |
|
| 15 | |
protected static String buildMessage(String msg, Throwable cause) { |
| 16 | 0 | if (cause == null) return msg; |
| 17 | 0 | if (!(cause instanceof WebslingerException)) return msg; |
| 18 | 0 | return msg + cause.getMessage(); |
| 19 | |
} |
| 20 | |
} |