Skip to content

Instantly share code, notes, and snippets.

@sherman
Created July 7, 2012 05:32
Show Gist options
  • Save sherman/3064910 to your computer and use it in GitHub Desktop.
Save sherman/3064910 to your computer and use it in GitHub Desktop.
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