From 72bf3459d840adb42afd5275f474c5ba8de1dd45 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Fri, 5 Jan 2024 13:31:56 -0500 Subject: [PATCH] api: improve error message --- src/Effectful/Servant.hs | 2 +- src/Monocle/Main.hs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Effectful/Servant.hs b/src/Effectful/Servant.hs index 87c77153b..619b46a0e 100644 --- a/src/Effectful/Servant.hs +++ b/src/Effectful/Servant.hs @@ -27,7 +27,7 @@ runWarpServerSettingsContext settings cfg serverEff middleware = do ( \es -> Warp.runSettings settings (middleware (hoistEff @api es cfg serverEff)) ) - error "Warp exited" + error "Oops, the listening server (warp) exited, that should not have happened" hoistEff :: forall (api :: Type) (context :: [Type]) (es :: [Effect]). diff --git a/src/Monocle/Main.hs b/src/Monocle/Main.hs index 9dc2b8050..813592d9a 100644 --- a/src/Monocle/Main.hs +++ b/src/Monocle/Main.hs @@ -181,9 +181,7 @@ run' ApiConfig {..} aplogger = E.runConcurrent $ runLoggerEffect do cfg (rootServer cookieCfg) middleware - case r of - Left e -> error (show e) - Right e -> error (show e) + error $ "The impossible has happened, the server stopped: " <> show r where corsPolicy = simpleCorsResourcePolicy {corsRequestHeaders = ["content-type"]}