From 15e05b90759b80793fa29fc72568cdab96cd35ea Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 6 Sep 2019 21:44:31 +0200 Subject: [PATCH] fix error messages --- src/Control/Product.hs | 12 ++++++------ src/Control/User.hs | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Control/Product.hs b/src/Control/Product.hs index ef36c95..c6e43ba 100644 --- a/src/Control/Product.hs +++ b/src/Control/Product.hs @@ -33,12 +33,12 @@ productStockRefill (Just _) amorefs = do conn <- rsConnection <$> ask void $ manualProductAmountRefill amorefs conn else - throwError $ err406 - { errBody = "Amounts less than 0 are not acceptable" + throwError $ err400 + { errBody = "Amounts less than 0 are not acceptable." } productStockRefill Nothing _ = throwError $ err403 - { errBody = "No Authentication present" + { errBody = "No Authentication present." } productStockUpdate :: Maybe Int -> [AmountUpdate] -> MateHandler () @@ -48,12 +48,12 @@ productStockUpdate (Just _) amoups = do conn <- rsConnection <$> ask void $ manualProductAmountUpdate amoups conn else - throwError $ err406 - { errBody = "Amounts less than 0 are not acceptable" + throwError $ err400 + { errBody = "Amounts less than 0 are not acceptable." } productStockUpdate Nothing _ = throwError $ err403 - { errBody = "No Authentication present" + { errBody = "No Authentication present." } productList :: MateHandler [ProductOverview] diff --git a/src/Control/User.hs b/src/Control/User.hs index 87964b7..c1e74d0 100644 --- a/src/Control/User.hs +++ b/src/Control/User.hs @@ -30,7 +30,7 @@ userNew us = do userGet :: Maybe Int -> Int -> MateHandler UserDetails userGet Nothing _ = throwError $ err403 - { errBody = "No Authentication present" + { errBody = "No Authentication present." } userGet (Just aid) id = if aid == id @@ -38,16 +38,16 @@ userGet (Just aid) id = now <- liftIO $ getCurrentTime conn <- rsConnection <$> ask -- void $ liftIO $ runUpdate_ conn (updateUser id us (utctDay now)) - userDetailsSelect conn id + userDetailsSelect id conn else throwError $ err403 - { errBody = "Wrong Authentication present" + { errBody = "Wrong Authentication present." } userUpdate :: Maybe Int -> Int -> UserDetailsSubmit -> MateHandler () userUpdate Nothing _ _ = throwError $ err403 - { errBody = "No Authentication present" + { errBody = "No Authentication present." } userUpdate (Just aid) id uds = if aid == id @@ -57,7 +57,7 @@ userUpdate (Just aid) id uds = void $ updateUserDetails id uds (utctDay now) conn else throwError $ err403 - { errBody = "Wrong Authentication present" + { errBody = "Wrong Authentication present." } userList :: Maybe Int -> Maybe Refine -> MateHandler [User] @@ -116,8 +116,8 @@ userTransfer (Just auid) (UserTransfer target amount) = { errBody = "You can not transfer yourself money." } else - throwError $ err403 - { errBody = "Wrong Authentication present" + throwError $ err400 + { errBody = "Amounts less or equal zero are not acceptable." } userTransfer Nothing _ = throwError $ err403