Defer error handling of runInputForm to user code.
This commit is contained in:
parent
c0e366bd72
commit
12897ae5a0
@ -65,12 +65,12 @@ runInputGet (FormInput f) = do
|
|||||||
toMap :: [(Text, a)] -> Map.Map Text [a]
|
toMap :: [(Text, a)] -> Map.Map Text [a]
|
||||||
toMap = Map.unionsWith (++) . map (\(x, y) -> Map.singleton x [y])
|
toMap = Map.unionsWith (++) . map (\(x, y) -> Map.singleton x [y])
|
||||||
|
|
||||||
runInputPost :: MonadHandler m => FormInput m a -> m a
|
runInputPost :: MonadHandler m => FormInput m a -> m (FormResult a)
|
||||||
runInputPost (FormInput f) = do
|
runInputPost (FormInput f) = do
|
||||||
(env, fenv) <- liftM (toMap *** toMap) runRequestBody
|
(env, fenv) <- liftM (toMap *** toMap) runRequestBody
|
||||||
m <- getYesod
|
m <- getYesod
|
||||||
l <- languages
|
l <- languages
|
||||||
emx <- f m l env fenv
|
emx <- f m l env fenv
|
||||||
case emx of
|
case emx of
|
||||||
Left errs -> invalidArgs $ errs []
|
Left errs -> return $ FormFailure (errs [])
|
||||||
Right x -> return x
|
Right x -> return (FormSuccess x)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user