From 3e6a1e6eba32f83f03652c5dda777e9a7c9cf1a9 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Mon, 11 Jul 2022 09:54:39 -0700 Subject: [PATCH] be more friendly to square failures. --- src/clj/auto_ap/square/core.clj | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/clj/auto_ap/square/core.clj b/src/clj/auto_ap/square/core.clj index 80b0eabd..6d3669ef 100644 --- a/src/clj/auto_ap/square/core.clj +++ b/src/clj/auto_ap/square/core.clj @@ -504,11 +504,16 @@ (catch [:status 401] data (mark-integration-status client {:integration-status/state :integration-state/unauthorized - :integration-status/message (-> data :body )})) - (catch Exception e + :integration-status/message (-> data :body str)})) + + (catch [:status 503] data + (mark-integration-status client {:integration-status/state :integration-state/failed + :integration-status/message (-> data :body str)})) + + (catch Object e (log/warn e) (mark-integration-status client {:integration-status/state :integration-state/failed - :integration-status/message (.getMessage e)})))))) + :integration-status/message (.getMessage (:wrapper &throw-context))})))))) (mount/defstate square-loader :start (scheduler/every (* 4 59 60 1000) (heartbeat upsert-all "square-loading"))