summaryrefslogtreecommitdiff
path: root/src/server/FastCGIUtils.hs
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-04-22 12:37:36 +0000
committerkrasimir <krasimir@chalmers.se>2010-04-22 12:37:36 +0000
commit9db279b24b32aa48892c807cf0a477811ef01234 (patch)
tree7ed688aa52829a83ffaa7d12afe757a38531be06 /src/server/FastCGIUtils.hs
parent007f501f05c050e909e90a4ae68eedd8f9794e2f (diff)
the pgf service now compiles with the latest CGI package
Diffstat (limited to 'src/server/FastCGIUtils.hs')
-rw-r--r--src/server/FastCGIUtils.hs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/server/FastCGIUtils.hs b/src/server/FastCGIUtils.hs
index 763eeb292..8d90c9fa7 100644
--- a/src/server/FastCGIUtils.hs
+++ b/src/server/FastCGIUtils.hs
@@ -8,7 +8,7 @@ module FastCGIUtils (initFastCGI, loopFastCGI,
splitBy) where
import Control.Concurrent
-import Control.OldException
+import Control.Exception
import Control.Monad
import Data.Dynamic
import Data.IORef
@@ -143,17 +143,19 @@ stderrToFile s = return ()
-- * General CGI Error exception mechanism
data CGIError = CGIError { cgiErrorCode :: Int, cgiErrorMessage :: String, cgiErrorText :: [String] }
- deriving Typeable
+ deriving (Show,Typeable)
+
+instance Exception CGIError where
+ toException e = SomeException e
+ fromException (SomeException e) = cast e
throwCGIError :: Int -> String -> [String] -> CGI a
-throwCGIError c m t = throwCGI $ DynException $ toDyn $ CGIError c m t
+throwCGIError c m t = throwCGI $ toException $ CGIError c m t
handleCGIErrors :: CGI CGIResult -> CGI CGIResult
-handleCGIErrors x = x `catchCGI` \e -> case e of
- DynException d -> case fromDynamic d of
- Nothing -> throw e
- Just (CGIError c m t) -> outputError c m t
- _ -> throw e
+handleCGIErrors x = x `catchCGI` \e -> case fromException e of
+ Nothing -> throw e
+ Just (CGIError c m t) -> outputError c m t
-- * General CGI and JSON stuff