Commit 4c97676e authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Improve startup error from runDbCheck

Previously we would fail with a generic message suggesting to run
`gargantext-init`, but that wouldn't always be the case; sometimes
there might be problems connecting to the database, and we want to
show the raw exception. This code should help diagnosing what's wrong.

It also changes the error hint to report the correct executable, as
these days we use `gargantext-cli init` instead.
parent 45eff945
Pipeline #6715 failed with stages
in 63 minutes and 11 seconds
......@@ -92,12 +92,13 @@ startGargantext mode port sf@(SettingsFile settingsFile) = withLoggerHoisted mod
where runDbCheck env = do
r <- runExceptT (runReaderT DB.dbCheck env) `catch`
(\(_ :: SomeException) -> pure $ Right False)
(\(err :: SomeException) -> pure $ Left err)
case r of
Right True -> pure ()
_ -> panicTrace $
"You must run 'gargantext-init " <> pack settingsFile <>
Right True -> pure ()
Right False -> panicTrace $
"You must run 'gargantext-cli init " <> pack settingsFile <>
"' before running gargantext-server (only the first time)."
Left err -> panicTrace $ "Unexpected exception:" <> show err
oneHour = Clock.fromNanoSecs 3600_000_000_000
portRouteInfo :: NotificationsConfig -> PortNumber -> MicroServicesProxyStatus -> IO ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment