diff options
author | Félix Sipma <felix.sipma@no-log.org> | 2018-12-15 19:30:52 +0100 |
---|---|---|
committer | Félix Sipma <felix.sipma@no-log.org> | 2018-12-15 19:30:52 +0100 |
commit | 4cda47a6a5d088595bfd5805d4c092f334a68965 (patch) | |
tree | ce2638149019d1faad858916bf63e1287128a179 | |
parent | d6a7ace989428724d1569f258292e579f6c8ee04 (diff) |
Handler: add UUID to server error messages
-rw-r--r-- | src/Shop/Handler.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Shop/Handler.hs b/src/Shop/Handler.hs index c0d30de..3559131 100644 --- a/src/Shop/Handler.hs +++ b/src/Shop/Handler.hs @@ -15,6 +15,8 @@ import Control.Monad.Logger (LoggingT, runStdoutLoggingT, import Data.Aeson (Value, encode) import Data.Default.Class (def) import qualified Data.Text as T +import qualified Data.UUID as UUID +import Data.UUID.V4 (nextRandom) import qualified Data.Yaml as Yaml import Formatting (format, (%), fixed) import Shop.Config @@ -181,8 +183,9 @@ instance Monoid (App a) where instance MonadHttp App where handleHttpException e = do - $(logError) $ toS $ displayException e - throwError err500 { errBody = "Erreur serveur, contactez-moi directement !" } + uuid <- liftIO nextRandom + $(logError) $ toS (displayException e) <> " " <> toS (UUID.toString uuid) + throwError err500 { errBody = "Erreur serveur " <> toS (UUID.toString uuid) } sendSMS :: SMS -> App () sendSMS sms = do |