summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorJohn J. Camilleri <john@johnjcamilleri.com>2020-09-14 22:42:37 +0200
committerGitHub <noreply@github.com>2020-09-14 22:42:37 +0200
commit6c54e5b63cb563d780843a1970cba0718a5203f8 (patch)
treeed6777f6cb20f9212fa29ce68fac7e22745c707c /src/server
parentbca0691cb028fe33ae1b77e71752d4e937490ff1 (diff)
parent8bcdeedba01847325cc89378fed114bc0561bd4d (diff)
Merge pull request #71 from anka-213/fix-newer-cabal
Fix support for newer stackage snapshots
Diffstat (limited to 'src/server')
-rw-r--r--src/server/CGI.hs2
-rw-r--r--src/server/CGIUtils.hs9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/server/CGI.hs b/src/server/CGI.hs
index 1a77351e2..821f93b9c 100644
--- a/src/server/CGI.hs
+++ b/src/server/CGI.hs
@@ -4,7 +4,7 @@ import Network.CGI as C(
CGI,ContentType(..),Accept(..),Language(..),
getVarWithDefault,readInput,negotiate,requestAcceptLanguage,getInput,
setHeader,output,outputFPS,outputError,
- handleErrors,catchCGI,throwCGI,
+ handleErrors,
liftIO)
import Network.CGI.Protocol as C(CGIResult(..),CGIRequest(..),Input(..),
Headers,HeaderName(..))
diff --git a/src/server/CGIUtils.hs b/src/server/CGIUtils.hs
index 04bb8f22c..3c5ce2274 100644
--- a/src/server/CGIUtils.hs
+++ b/src/server/CGIUtils.hs
@@ -15,11 +15,14 @@ import System.Posix
#endif
import CGI(CGI,CGIResult,setHeader,output,outputFPS,outputError,
- getInput,catchCGI,throwCGI)
+ getInput)
import Text.JSON
import qualified Codec.Binary.UTF8.String as UTF8 (encodeString)
import qualified Data.ByteString.Lazy as BS
+import Control.Monad.Catch (MonadThrow(throwM))
+import Network.CGI.Monad (catchCGI)
+import Control.Monad.Catch (MonadCatch(catch))
-- * Logging
@@ -53,11 +56,11 @@ instance Exception CGIError where
fromException (SomeException e) = cast e
throwCGIError :: Int -> String -> [String] -> CGI a
-throwCGIError c m t = throwCGI $ toException $ CGIError c m t
+throwCGIError c m t = throwM $ toException $ CGIError c m t
handleCGIErrors :: CGI CGIResult -> CGI CGIResult
handleCGIErrors x =
- x `catchCGI` \e -> case fromException e of
+ x `catch` \e -> case fromException e of
Nothing -> throw e
Just (CGIError c m t) -> do setXO; outputError c m t