mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-13 11:27:28 +01:00
Don't let a SQL connection failure be a problem during defaultLayout
This commit is contained in:
parent
e87156a059
commit
829b107eb9
@ -5,6 +5,7 @@ import Data.BlobStore
|
|||||||
import Data.Slug (safeMakeSlug, HasGenIO (getGenIO), randomSlug, Slug, SnapSlug)
|
import Data.Slug (safeMakeSlug, HasGenIO (getGenIO), randomSlug, Slug, SnapSlug)
|
||||||
import Data.WebsiteContent
|
import Data.WebsiteContent
|
||||||
import qualified Database.Persist
|
import qualified Database.Persist
|
||||||
|
import Database.Persist.Sql (PersistentSqlException (Couldn'tGetSQLConnection))
|
||||||
import Model
|
import Model
|
||||||
import qualified Settings
|
import qualified Settings
|
||||||
import Settings (widgetFile, Extra (..), GoogleAuth (..))
|
import Settings (widgetFile, Extra (..), GoogleAuth (..))
|
||||||
@ -95,7 +96,9 @@ instance Yesod App where
|
|||||||
|
|
||||||
defaultLayout widget = do
|
defaultLayout widget = do
|
||||||
mmsg <- getMessage
|
mmsg <- getMessage
|
||||||
muser <- maybeAuth
|
muser <- catch maybeAuth $ \e -> case e of
|
||||||
|
Couldn'tGetSQLConnection -> return Nothing
|
||||||
|
_ -> throwM e
|
||||||
|
|
||||||
-- We break up the default layout into two components:
|
-- We break up the default layout into two components:
|
||||||
-- default-layout is the contents of the body tag, and
|
-- default-layout is the contents of the body tag, and
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user