fix error messages

This commit is contained in:
nek0 2019-09-06 21:44:31 +02:00
parent 537a88638f
commit 15e05b9075
2 changed files with 13 additions and 13 deletions

View file

@ -33,12 +33,12 @@ productStockRefill (Just _) amorefs = do
conn <- rsConnection <$> ask conn <- rsConnection <$> ask
void $ manualProductAmountRefill amorefs conn void $ manualProductAmountRefill amorefs conn
else else
throwError $ err406 throwError $ err400
{ errBody = "Amounts less than 0 are not acceptable" { errBody = "Amounts less than 0 are not acceptable."
} }
productStockRefill Nothing _ = productStockRefill Nothing _ =
throwError $ err403 throwError $ err403
{ errBody = "No Authentication present" { errBody = "No Authentication present."
} }
productStockUpdate :: Maybe Int -> [AmountUpdate] -> MateHandler () productStockUpdate :: Maybe Int -> [AmountUpdate] -> MateHandler ()
@ -48,12 +48,12 @@ productStockUpdate (Just _) amoups = do
conn <- rsConnection <$> ask conn <- rsConnection <$> ask
void $ manualProductAmountUpdate amoups conn void $ manualProductAmountUpdate amoups conn
else else
throwError $ err406 throwError $ err400
{ errBody = "Amounts less than 0 are not acceptable" { errBody = "Amounts less than 0 are not acceptable."
} }
productStockUpdate Nothing _ = productStockUpdate Nothing _ =
throwError $ err403 throwError $ err403
{ errBody = "No Authentication present" { errBody = "No Authentication present."
} }
productList :: MateHandler [ProductOverview] productList :: MateHandler [ProductOverview]

View file

@ -30,7 +30,7 @@ userNew us = do
userGet :: Maybe Int -> Int -> MateHandler UserDetails userGet :: Maybe Int -> Int -> MateHandler UserDetails
userGet Nothing _ = userGet Nothing _ =
throwError $ err403 throwError $ err403
{ errBody = "No Authentication present" { errBody = "No Authentication present."
} }
userGet (Just aid) id = userGet (Just aid) id =
if aid == id if aid == id
@ -38,16 +38,16 @@ userGet (Just aid) id =
now <- liftIO $ getCurrentTime now <- liftIO $ getCurrentTime
conn <- rsConnection <$> ask conn <- rsConnection <$> ask
-- void $ liftIO $ runUpdate_ conn (updateUser id us (utctDay now)) -- void $ liftIO $ runUpdate_ conn (updateUser id us (utctDay now))
userDetailsSelect conn id userDetailsSelect id conn
else else
throwError $ err403 throwError $ err403
{ errBody = "Wrong Authentication present" { errBody = "Wrong Authentication present."
} }
userUpdate :: Maybe Int -> Int -> UserDetailsSubmit -> MateHandler () userUpdate :: Maybe Int -> Int -> UserDetailsSubmit -> MateHandler ()
userUpdate Nothing _ _ = userUpdate Nothing _ _ =
throwError $ err403 throwError $ err403
{ errBody = "No Authentication present" { errBody = "No Authentication present."
} }
userUpdate (Just aid) id uds = userUpdate (Just aid) id uds =
if aid == id if aid == id
@ -57,7 +57,7 @@ userUpdate (Just aid) id uds =
void $ updateUserDetails id uds (utctDay now) conn void $ updateUserDetails id uds (utctDay now) conn
else else
throwError $ err403 throwError $ err403
{ errBody = "Wrong Authentication present" { errBody = "Wrong Authentication present."
} }
userList :: Maybe Int -> Maybe Refine -> MateHandler [User] userList :: Maybe Int -> Maybe Refine -> MateHandler [User]
@ -116,8 +116,8 @@ userTransfer (Just auid) (UserTransfer target amount) =
{ errBody = "You can not transfer yourself money." { errBody = "You can not transfer yourself money."
} }
else else
throwError $ err403 throwError $ err400
{ errBody = "Wrong Authentication present" { errBody = "Amounts less or equal zero are not acceptable."
} }
userTransfer Nothing _ = userTransfer Nothing _ =
throwError $ err403 throwError $ err403