From ef35972270c3b14d73783eac2d1089846f3f4f13 Mon Sep 17 00:00:00 2001 From: Hunter Jackson Date: Wed, 14 Aug 2024 09:16:15 -0400 Subject: [PATCH] Handle Jackson throwing a Throwable, not an Exception --- src/main/java/com/meta/cp4m/message/WAMessageHandler.java | 2 +- .../java/com/meta/cp4m/message/webhook/whatsapp/Status.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/meta/cp4m/message/WAMessageHandler.java b/src/main/java/com/meta/cp4m/message/WAMessageHandler.java index 48e45c9..db42b3f 100644 --- a/src/main/java/com/meta/cp4m/message/WAMessageHandler.java +++ b/src/main/java/com/meta/cp4m/message/WAMessageHandler.java @@ -232,7 +232,7 @@ public List> routeDetails() { try { payload = MAPPER.readValue(bodyString, WebhookPayload.class); return Optional.of(payload); - } catch (Exception e) { + } catch (Throwable e) { LOGGER.atWarn().setCause(e).log("unable to parse payload"); return Optional.empty(); } diff --git a/src/main/java/com/meta/cp4m/message/webhook/whatsapp/Status.java b/src/main/java/com/meta/cp4m/message/webhook/whatsapp/Status.java index a383e9a..8767ed6 100644 --- a/src/main/java/com/meta/cp4m/message/webhook/whatsapp/Status.java +++ b/src/main/java/com/meta/cp4m/message/webhook/whatsapp/Status.java @@ -78,7 +78,8 @@ public int hashCode() { public enum StatusType { DELIVERED, READ, - SENT; + SENT, + FAILED; public String toString() { return this.name().toLowerCase();