refactor for boolean blindness

This commit is contained in:
Lucy Cifferello
2020-07-07 17:38:17 -06:00
parent bce11215d3
commit 7232c48292
5 changed files with 32 additions and 14 deletions

View File

@@ -55,3 +55,8 @@ handleS9ErrNuclear :: MonadIO m => S9ErrT m a -> m a
handleS9ErrNuclear action = runExceptT action >>= \case
Left e -> throwIO e
Right a -> pure a
errOnNothing :: MonadHandler m => Status -> Text -> Maybe a -> m a
errOnNothing status res entity = case entity of
Nothing -> sendResponseStatus status res
Just a -> pure a