summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-03 20:04:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-03 20:04:24 -0400
commit4c3da00bb630fb5d08fae8df7a46cb341020744e (patch)
tree38c2cc73f2eeab1aa5d2edab766b38ddbde8290a /Logs
parent9ec525f29489ac76ba5910e2189fbdc86c5ca856 (diff)
show an error message if garbage is provided to dropunused
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Unused.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Logs/Unused.hs b/Logs/Unused.hs
index 9f1278dd0..bef78a992 100644
--- a/Logs/Unused.hs
+++ b/Logs/Unused.hs
@@ -62,11 +62,12 @@ withUnusedMaps a params = do
unusedSpec :: String -> [Int]
unusedSpec spec
| "-" `isInfixOf` spec = range $ separate (== '-') spec
- | otherwise = catMaybes [readish spec]
+ | otherwise = maybe badspec (: []) (readish spec)
where
range (a, b) = case (readish a, readish b) of
(Just x, Just y) -> [x..y]
- _ -> []
+ _ -> badspec
+ badspec = error $ "Expected number or range, not \"" ++ spec ++ "\""
{- Start action for unused content. Finds the number in the maps, and
- calls either of 3 actions, depending on the type of unused file. -}