Created
July 7, 2012 05:32
-
-
Save sherman/3064910 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FSBridgeClientException extends RuntimeException { | |
private final FSBridgeClientError error; | |
public FSBridgeClientException(Throwable e, FSBridgeClientError error) { | |
super(e); | |
this.error = error; | |
} | |
public FSBridgeClientException(FSBridgeClientError error) { | |
this.error = error; | |
} | |
public FSBridgeClientError getError() { | |
return error; | |
} | |
@NotNull | |
public static FSBridgeClientException timeout(Throwable e) { | |
return new FSBridgeClientException(e, FSBridgeClientError.TIMEOUT); | |
} | |
@NotNull | |
public static FSBridgeClientException other(Throwable e) { | |
return new FSBridgeClientException(e, FSBridgeClientError.OTHER); | |
} | |
@NotNull | |
public static FSBridgeClientException other() { | |
return new FSBridgeClientException(FSBridgeClientError.OTHER); | |
} | |
@NotNull | |
public static FSBridgeClientException invalidJson(Throwable e) { | |
return new FSBridgeClientException(e, FSBridgeClientError.INVALID_JSON); | |
} | |
@NotNull | |
public static FSBridgeClientException invalidURI(Throwable e) { | |
return new FSBridgeClientException(e, FSBridgeClientError.INVALID_URI); | |
} | |
@NotNull | |
public static FSBridgeClientException noResponse(Throwable e) { | |
return new FSBridgeClientException(e, FSBridgeClientError.NO_RESPONSE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment