;tweak a few parse errors for clarity, consistency (#1329)

This commit is contained in:
Simon Michael 2020-09-19 08:10:39 -07:00
parent 1affcb727c
commit c5513ba722
4 changed files with 6 additions and 6 deletions

View File

@ -172,7 +172,7 @@ amountApplyValuation priceoracle styles periodlast mreportlast today ismultiperi
-- | Standard error message for a report not supporting --value=then. -- | Standard error message for a report not supporting --value=then.
unsupportedValueThenError :: String unsupportedValueThenError :: String
unsupportedValueThenError = "Sorry, --value=then is not yet implemented for this kind of report." unsupportedValueThenError = "Sorry, --value=then is not yet supported for this kind of report."
-- | Find the market value of each component amount in the given -- | Find the market value of each component amount in the given
-- commodity, or its default valuation commodity, at the given -- commodity, or its default valuation commodity, at the given

View File

@ -466,7 +466,7 @@ datep' mYear = do
let dateStr = show year ++ [sep1] ++ show month ++ [sep2] ++ show day let dateStr = show year ++ [sep1] ++ show month ++ [sep2] ++ show day
when (sep1 /= sep2) $ customFailure $ parseErrorAtRegion startOffset endOffset $ when (sep1 /= sep2) $ customFailure $ parseErrorAtRegion startOffset endOffset $
"invalid date (mixing date separators is not allowed): " ++ dateStr "invalid date: separators are different, should be the same"
case fromGregorianValid year month day of case fromGregorianValid year month day of
Nothing -> customFailure $ parseErrorAtRegion startOffset endOffset $ Nothing -> customFailure $ parseErrorAtRegion startOffset endOffset $
@ -846,7 +846,7 @@ fromRawNumber
-> Either String -> Either String
(Quantity, Word8, Maybe Char, Maybe DigitGroupStyle) (Quantity, Word8, Maybe Char, Maybe DigitGroupStyle)
fromRawNumber (WithSeparators _ _ _) (Just _) = fromRawNumber (WithSeparators _ _ _) (Just _) =
Left "invalid number: mixing digit separators with exponents is not allowed" Left "invalid number: digit separators and exponents may not be used together"
fromRawNumber raw mExp = do fromRawNumber raw mExp = do
(quantity, precision) <- toQuantity (fromMaybe 0 mExp) (digitGroup raw) (decimalGroup raw) (quantity, precision) <- toQuantity (fromMaybe 0 mExp) (digitGroup raw) (decimalGroup raw)
return (quantity, precision, mDecPt raw, digitGroupStyle raw) return (quantity, precision, mDecPt raw, digitGroupStyle raw)
@ -855,7 +855,7 @@ fromRawNumber raw mExp = do
toQuantity e preDecimalGrp postDecimalGrp toQuantity e preDecimalGrp postDecimalGrp
| precision < 0 = Right (Decimal 0 (digitGrpNum * 10^(-precision)), 0) | precision < 0 = Right (Decimal 0 (digitGrpNum * 10^(-precision)), 0)
| precision < 256 = Right (Decimal precision8 digitGrpNum, precision8) | precision < 256 = Right (Decimal precision8 digitGrpNum, precision8)
| otherwise = Left "invalid number: numbers with more than 255 decimal digits are not allowed at this time" | otherwise = Left "invalid number: numbers with more than 255 decimal places are currently not supported"
where where
digitGrpNum = digitGroupNumber $ preDecimalGrp <> postDecimalGrp digitGrpNum = digitGroupNumber $ preDecimalGrp <> postDecimalGrp
precision = toInteger (digitGroupLength postDecimalGrp) - e precision = toInteger (digitGroupLength postDecimalGrp) - e

View File

@ -495,7 +495,7 @@ multiBalanceReportAsHtml ropts mbr =
multiBalanceReportHtmlRows :: ReportOpts -> MultiBalanceReport -> (Html (), [Html ()], Maybe (Html ())) multiBalanceReportHtmlRows :: ReportOpts -> MultiBalanceReport -> (Html (), [Html ()], Maybe (Html ()))
multiBalanceReportHtmlRows ropts mbr = multiBalanceReportHtmlRows ropts mbr =
let let
headingsrow:rest | transpose_ ropts = error' "Sorry, --transpose is not supported with HTML output yet" -- PARTIAL: headingsrow:rest | transpose_ ropts = error' "Sorry, --transpose with HTML output is not yet supported" -- PARTIAL:
| otherwise = multiBalanceReportAsCsv ropts mbr | otherwise = multiBalanceReportAsCsv ropts mbr
(bodyrows, mtotalsrow) | no_total_ ropts = (rest, Nothing) (bodyrows, mtotalsrow) | no_total_ ropts = (rest, Nothing)
| otherwise = (init rest, Just $ last rest) | otherwise = (init rest, Just $ last rest)

View File

@ -60,7 +60,7 @@ import Hledger.Utils
-- | Standard error message for a bad output format specified with -O/-o. -- | Standard error message for a bad output format specified with -O/-o.
unsupportedOutputFormatError :: String -> String unsupportedOutputFormatError :: String -> String
unsupportedOutputFormatError fmt = "Sorry, output format \""++fmt++"\" is unrecognised or not yet implemented for this report or report mode." unsupportedOutputFormatError fmt = "Sorry, output format \""++fmt++"\" is unrecognised or not yet supported for this kind of report."
-- | Parse the user's specified journal file(s) as a Journal, maybe apply some -- | Parse the user's specified journal file(s) as a Journal, maybe apply some
-- transformations according to options, and run a hledger command with it. -- transformations according to options, and run a hledger command with it.