diff --git a/src/Core.hs b/src/Core.hs index c431b92..b9ce564 100644 --- a/src/Core.hs +++ b/src/Core.hs @@ -62,20 +62,21 @@ writeLog = send . WriteLog runLoggerIO :: (IOE :> es, Error ServerError :> es) => Eff (Logger : es) a -> Eff es a runLoggerIO = interpret $ \_ -> \case - WriteLog msg -> adapt $ log msg + WriteLog msg -> log msg where - log :: String -> IO () - log msg = putStrLn msg + log :: (IOE :> es, Error ServerError :> es) => String -> Eff es () + log msg = adapt $ putStrLn msg -- Utility adapt :: (IOE :> es, Error ServerError :> es) => IO a -> Eff es a -adapt m = liftIO m `catch` \(e::IOException) -> +adapt m = liftIO m `catch` \(e::IOException) -> do + liftIO $ putStrLn $ "ERROR Exception: " ++ show e throwError $ ServerError - { errHTTPCode = 500 - , errReasonPhrase = "Internal Database Error" - , errBody = fromString $ show e - , errHeaders = [] - } + { errHTTPCode = 500 + , errReasonPhrase = "Internal Server Error" + , errBody = "This incident will be investigated." + , errHeaders = [] + } -- -- Routes