From 12897ae5a06c04a62124bf457527c31be65cf62b Mon Sep 17 00:00:00 2001 From: Elise Huard Date: Thu, 30 Jan 2014 15:28:56 +0100 Subject: [PATCH] Defer error handling of runInputForm to user code. --- yesod-form/Yesod/Form/Input.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yesod-form/Yesod/Form/Input.hs b/yesod-form/Yesod/Form/Input.hs index 6cbe8dd0..adf2c982 100644 --- a/yesod-form/Yesod/Form/Input.hs +++ b/yesod-form/Yesod/Form/Input.hs @@ -65,12 +65,12 @@ runInputGet (FormInput f) = do toMap :: [(Text, a)] -> Map.Map Text [a] 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 (env, fenv) <- liftM (toMap *** toMap) runRequestBody m <- getYesod l <- languages emx <- f m l env fenv case emx of - Left errs -> invalidArgs $ errs [] - Right x -> return x + Left errs -> return $ FormFailure (errs []) + Right x -> return (FormSuccess x)