Skip to content

Commit

Permalink
Merge pull request #54 from kiranshila/develop
Browse files Browse the repository at this point in the history
Trace-level HTTP logging
  • Loading branch information
kiranshila authored Jan 18, 2022
2 parents 03fac8c + 5ac858d commit 43325f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/doplarr/interaction_state_machine.clj
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@
:embed (m/create-message! messaging channel-id (discord/request-performed-embed embed user-id))
(m/create-message! messaging channel-id (discord/request-performed-plain payload media-type user-id)))))))
(else (fn [e]
(let [{:keys [status body] :as data} (ex-data e)]
(let [{:keys [status body]} (ex-data e)]
(if (= status 403)
(->> @(m/edit-original-interaction-response! messaging bot-id token (discord/content-response (body "message")))
(else #(fatal % "Error in sending request failure response")))
(->> @(m/edit-original-interaction-response! messaging bot-id token (discord/content-response "Unspecified error on request, check logs"))
(then #(fatal data "Non 403 error on request"))
(then #(fatal % "Non 403 error on request"))
(else #(fatal % "Error in sending error response")))))))))))

(defn continue-interaction! [interaction]
Expand Down
3 changes: 2 additions & 1 deletion src/doplarr/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[doplarr.state :as state]
[fmnoise.flow :as flow :refer [else then]]
[hato.client :as hc]
[taoensso.timbre :refer [fatal]]))
[taoensso.timbre :refer [fatal trace]]))

(defn deep-merge [a & maps]
(if (map? a)
Expand All @@ -18,6 +18,7 @@
(defn http-request [method url key & [params]]
(let [chan (a/promise-chan)
put (partial a/put! chan)]
(trace "Performing HTTP request" method url params)
(hc/request
(deep-merge
{:method method
Expand Down

0 comments on commit 43325f6

Please sign in to comment.