Skip to content

Commit 2385243

Browse files
committed
slingshot usage example
1 parent ebf4aa2 commit 2385243

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.org

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,23 @@ HTTP responses other than =#{200 201 202 203 204 205 206 207 300 301 302 303
434434

435435
(spacing added by me to be human readable)
436436

437+
How to use with Slingshot:
438+
439+
#+BEGIN_SRC
440+
; Response map is thrown as exception obj.
441+
; We filter out by status codes
442+
(try+
443+
(client/get "http://some-site.com/broken")
444+
(catch [:status 403] {:keys [request-time headers body]}
445+
(log/warn "403" request-time headers))
446+
(catch [:status 404] {:keys [request-time headers body]}
447+
(log/warn "NOT Found 404" request-time headers body))
448+
(catch Object _
449+
(log/error (:throwable &throw-context) "unexpected error")
450+
(throw+)))
451+
#+END_SRC
452+
453+
437454
** Proxies
438455

439456
A proxy can be specified by setting the Java properties: =<scheme>.proxyHost=

0 commit comments

Comments
 (0)