S2S: If sharer inbox handler fails, return and log the error message

This commit is contained in:
fr33domlover 2020-05-24 13:53:31 +00:00
parent d56a7411fc
commit 417fcd3e94

View file

@ -37,6 +37,7 @@ import Control.Concurrent.STM.TVar (readTVarIO, modifyTVar')
import Control.Exception hiding (Handler) import Control.Exception hiding (Handler)
import Control.Monad import Control.Monad
import Control.Monad.IO.Class (liftIO) import Control.Monad.IO.Class (liftIO)
import Control.Monad.Logger.CallStack
import Control.Monad.STM (atomically) import Control.Monad.STM (atomically)
import Control.Monad.Trans.Except import Control.Monad.Trans.Except
import Data.Aeson import Data.Aeson
@ -58,7 +59,7 @@ import Text.Blaze.Html (Html, preEscapedToHtml)
import Text.Blaze.Html.Renderer.Text import Text.Blaze.Html.Renderer.Text
import Text.HTML.SanitizeXSS import Text.HTML.SanitizeXSS
import Text.Shakespeare.I18N (RenderMessage) import Text.Shakespeare.I18N (RenderMessage)
import Yesod.Core import Yesod.Core hiding (logDebug)
import Yesod.Core.Handler import Yesod.Core.Handler
import Yesod.Form.Fields import Yesod.Form.Fields
import Yesod.Form.Functions import Yesod.Form.Functions
@ -277,7 +278,9 @@ postSharerInboxR shrRecip = do
(actbObject body,) <$> handleSharerInbox now shrRecip auth body (actbObject body,) <$> handleSharerInbox now shrRecip auth body
recordActivity now result contentTypes recordActivity now result contentTypes
case result of case result of
Left _ -> sendResponseStatus badRequest400 () Left err -> do
logDebug err
sendResponseStatus badRequest400 err
Right _ -> return () Right _ -> return ()
recordActivity now result contentTypes = do recordActivity now result contentTypes = do