diff options
Diffstat (limited to 'Omni/Task')
| -rw-r--r-- | Omni/Task/Core.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index 61a2e83..c469bf8 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -162,14 +162,18 @@ instance FromJSON Fact -- HTTP API Instances (for Servant query params) instance FromHttpApiData Status where - parseQueryParam t = case readMaybe (T.unpack t) of - Just s -> Right s - Nothing -> Left ("Invalid status: " <> t) + parseQueryParam t + | T.null t = Left "No status provided" + | otherwise = case readMaybe (T.unpack t) of + Just s -> Right s + Nothing -> Left ("Invalid status: " <> t) instance FromHttpApiData Priority where - parseQueryParam t = case readMaybe (T.unpack t) of - Just p -> Right p - Nothing -> Left ("Invalid priority: " <> t) + parseQueryParam t + | T.null t = Left "No priority provided" + | otherwise = case readMaybe (T.unpack t) of + Just p -> Right p + Nothing -> Left ("Invalid priority: " <> t) -- SQLite Instances |
