From 0a13451621e67675c1fc4a74923df1ebfefe3967 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 4 Jan 2019 10:53:23 +0300 Subject: catch okhttp exceptions --- src/main/java/com/juick/server/SignatureManager.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/java') 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 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 discoverPerson(String acct) { Jid acctId = Jid.of(acct); -- cgit v1.2.3