From f1a57a23147ae704503cca0053ec7bd371360948 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 12 Sep 2017 22:38:13 +0200 Subject: [PATCH] Better no results response (resolves #3) --- cloogleirc.icl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloogleirc.icl b/cloogleirc.icl index 0fc25f9..c9a464e 100644 --- a/cloogleirc.icl +++ b/cloogleirc.icl @@ -56,7 +56,7 @@ shorten s w cloogle :: String *World -> (String, *World) cloogle data w -# (mer, w) = doHTTPRequestL +# (mer, w) = doHTTPRequestFollowRedirects { newHTTPRequest & req_path = "/api.php" , req_query = "?str=" + urlEncode data @@ -67,6 +67,7 @@ cloogle data w # resp = fromOk mer = case fromJSON $ fromString resp.HTTPResponse.rsp_data of Nothing = ("couldn't parse json", w) + Just {return=127} = ("No results for " + data, w) Just clr = ("Results for " + data + " -- https://cloogle.org/#" + replaceSubString "+" "%20" (urlEncode data) + "\n" + processResults clr, w) -- 2.20.1