From 28dac9ad475e90d48e67ab8e66b93d8bbf8d4302 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Thu, 10 Oct 2019 21:32:51 +0200 Subject: [PATCH] Add timeout exception --- src/wordpress_used/core.clj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wordpress_used/core.clj b/src/wordpress_used/core.clj index ca8d7fe..d351637 100644 --- a/src/wordpress_used/core.clj +++ b/src/wordpress_used/core.clj @@ -15,8 +15,12 @@ (defn wordpress? "Check if a web page is generated with WordPress" [url] - (let [response (client/get (str "http://" url "/") {:ignore-unknown-host? true, :connection-timeout 5000, :throw-exceptions false})] - (every? identity [(re-find (re-pattern "meta.*generator.*WordPress") (:body response))]))) + (try + (let [response (client/get (str "http://" url "/") {:ignore-unknown-host? true, :connection-timeout 5000, :throw-exceptions false})] + (every? identity [(re-find (re-pattern "meta.*generator.*WordPress") (:body response))])) + (catch Exception e + "timeout" + ))) (defn -main [& args]