Skip to content

Commit ba8cff0

Browse files
committed
fix:lib:Hledger.Query: parseQueryTerm: don't call error for a bad amt: argument
1 parent 09e2078 commit ba8cff0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hledger-lib/Hledger/Query.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ parseQueryTerm _ (T.stripPrefix "status:" -> Just s) =
309309
case parseStatus s of Left e -> Left $ "\"status:"++T.unpack s++"\" gave a parse error: " ++ e
310310
Right st -> Right (StatusQ st, [])
311311
parseQueryTerm _ (T.stripPrefix "real:" -> Just s) = Right (Real $ parseBool s || T.null s, [])
312-
parseQueryTerm _ (T.stripPrefix "amt:" -> Just s) = Right (Amt ord q, []) where (ord, q) = either error' id $ parseAmountQueryTerm s -- PARTIAL:
312+
parseQueryTerm _ (T.stripPrefix "amt:" -> Just s) = case parseAmountQueryTerm s of
313+
Right (ord, q) -> Right (Amt ord q, [])
314+
Left err -> Left err
313315
parseQueryTerm _ (T.stripPrefix "depth:" -> Just s) = (,[]) <$> parseDepthSpecQuery s
314316
parseQueryTerm _ (T.stripPrefix "cur:" -> Just s) = (,[]) . Sym <$> toRegexCI ("^" <> s <> "$") -- support cur: as an alias
315317
parseQueryTerm _ (T.stripPrefix "tag:" -> Just s) = (,[]) <$> parseTag s

0 commit comments

Comments
 (0)