Commit f1a57a23 authored by Camil Staps's avatar Camil Staps 🚀

Better no results response (resolves #3)

parent ad6f64c9
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment