aboutsummaryrefslogtreecommitdiff
path: root/src/Cana.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cana.hs')
-rw-r--r--src/Cana.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Cana.hs b/src/Cana.hs
index 5822ccb..5d80057 100644
--- a/src/Cana.hs
+++ b/src/Cana.hs
@@ -149,8 +149,16 @@ canaClient socket = do
route <- findRoute geminiRequest
case route of
Just r -> do
- response <- r geminiRequest
- writeResponse context response
+ response <- uncatch $ r geminiRequest
+ case response of
+ Left l -> do
+ writeResponse context $ GeminiResponse
+ { responseStatus = codeTemporaryFailure
+ , responseMeta = "Internal server error"
+ , responseData = ""
+ }
+ throw l
+ Right r -> writeResponse context r
Nothing -> do
writeResponse context $ GeminiResponse
{ responseStatus = codeNotFound