diff options
author | Vitaly Takmazov | 2019-01-04 10:53:23 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-01-04 10:53:23 +0300 |
commit | 0a13451621e67675c1fc4a74923df1ebfefe3967 (patch) | |
tree | 2b4a6afd7f9de4c6eaa3ad5468e3566655a923ac /src/main/java/com/juick | |
parent | 320d35f76ba5093a426e005a806a5a11787662ad (diff) |
catch okhttp exceptions
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/server/SignatureManager.java | 15 |
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); |