Route Flags load warnings to stderr

This commit is contained in:
2026-09-25 13:02:14 +03:00
parent 44497173de
commit 3b08988e30
+3 -2
View File
@@ -24,6 +24,7 @@ import Data.Set (Set)
import qualified Data.Set as S import qualified Data.Set as S
import Data.Text (Text) import Data.Text (Text)
import System.FilePath ((</>)) import System.FilePath ((</>))
import System.IO (hPutStrLn, stderr)
import System.IO.Error (isDoesNotExistError) import System.IO.Error (isDoesNotExistError)
type Name = Text type Name = Text
@@ -56,7 +57,7 @@ readFlagsFile path =
decoded <- decodeFileStrict' path decoded <- decodeFileStrict' path
case decoded of case decoded of
Nothing -> do Nothing -> do
putStrLn ("handlers.json is unparseable; treating all handlers as enabled: " <> path) hPutStrLn stderr ("handlers.json is unparseable; treating all handlers as enabled: " <> path)
pure mempty pure mempty
Just m -> pure (maybe mempty id m) Just m -> pure (maybe mempty id m)
where where
@@ -64,7 +65,7 @@ readFlagsFile path =
onMissingOrUnreadable e onMissingOrUnreadable e
| isDoesNotExistError e = pure mempty | isDoesNotExistError e = pure mempty
| otherwise = do | otherwise = do
putStrLn ("could not read handlers.json (" <> show e <> "); treating all handlers as enabled") hPutStrLn stderr ("could not read handlers.json (" <> show e <> "); treating all handlers as enabled")
pure mempty pure mempty
isEnabled :: MonadIO m => Flags -> Name -> m Bool isEnabled :: MonadIO m => Flags -> Name -> m Bool