aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/trygvis/esper/testing/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/trygvis/esper/testing/util')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/util/HttpClient.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/util/HttpClient.java b/src/main/java/io/trygvis/esper/testing/util/HttpClient.java
index 79159ac..5ac7d13 100755
--- a/src/main/java/io/trygvis/esper/testing/util/HttpClient.java
+++ b/src/main/java/io/trygvis/esper/testing/util/HttpClient.java
@@ -16,6 +16,7 @@ import org.slf4j.*;
import java.io.*;
import java.net.*;
+import static fj.data.Option.none;
import static java.lang.System.*;
public class HttpClient<A> {
@@ -44,7 +45,7 @@ public class HttpClient<A> {
};
}
- public Option<A> fetch(URI uri) throws IOException {
+ public Option<A> fetch(URI uri) {
HTTPResponse response = null;
try {
@@ -52,12 +53,14 @@ public class HttpClient<A> {
int code = response.getStatus().getCode();
if (code != 200) {
- throw new IOException("Did not get 200 back, got " + code);
+ logger.warn("Did not get 200 back, got " + code);
+ return none();
}
return f.f(response);
} catch (HTTPException e) {
- throw new IOException(e);
+ logger.warn("Error while fetching: " + uri, e);
+ return none();
} finally {
if (response != null) {
try {