aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-01-04 10:53:23 +0300
committerGravatar Vitaly Takmazov2019-01-04 10:53:23 +0300
commit0a13451621e67675c1fc4a74923df1ebfefe3967 (patch)
tree2b4a6afd7f9de4c6eaa3ad5468e3566655a923ac /src
parent320d35f76ba5093a426e005a806a5a11787662ad (diff)
catch okhttp exceptions
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/server/SignatureManager.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/com/juick/server/SignatureManager.java b/src/main/java/com/juick/server/SignatureManager.java
index 26e482ad..9ecdaad5 100644
--- a/src/main/java/com/juick/server/SignatureManager.java
+++ b/src/main/java/com/juick/server/SignatureManager.java
@@ -97,12 +97,17 @@ public class SignatureManager {
throw new IOException("Person not found");
}
public Optional<Context> getContext(URI contextUri) {
- Context context = apClient.getForEntity(contextUri, Context.class).getBody();
- if (context == null) {
- logger.warn("Cannot identify {}", contextUri);
- return Optional.empty();
+ try {
+ Context context = apClient.getForEntity(contextUri, Context.class).getBody();
+ if (context == null) {
+ logger.warn("Cannot identify {}", contextUri);
+ return Optional.empty();
+ }
+ return Optional.of(context);
+ } catch (Exception e) {
+ logger.warn("REST Exception processing {}", contextUri, e);
}
- return Optional.of(context);
+ return Optional.empty();
}
public Optional<Context> discoverPerson(String acct) {
Jid acctId = Jid.of(acct);