imp: include: give a clearer error for trying to include a csv file
And note that other read errors may be unclear when occurring in included files.
This commit is contained in:
parent
8215f19baa
commit
b35dcfda28
@ -46,7 +46,12 @@ reader sep = Reader
|
|||||||
{rFormat = Sep sep
|
{rFormat = Sep sep
|
||||||
,rExtensions = [show sep]
|
,rExtensions = [show sep]
|
||||||
,rReadFn = parse sep
|
,rReadFn = parse sep
|
||||||
,rParser = error' "sorry, CSV files can't be included yet" -- PARTIAL:
|
,rParser = fail "sorry, CSV files can't be included yet" -- PARTIAL:
|
||||||
|
-- This unnecessarily shows the CSV file's first line in the error message,
|
||||||
|
-- but gives a more useful message than just calling error'.
|
||||||
|
-- XXX Note every call to error' in Hledger.Read.* is potentially a similar problem -
|
||||||
|
-- the error message is good enough when the file was specified directly by the user,
|
||||||
|
-- but not good if it was loaded by a possibly long chain of include directives.
|
||||||
}
|
}
|
||||||
|
|
||||||
-- | Parse and post-process a "Journal" from CSV data, or give an error.
|
-- | Parse and post-process a "Journal" from CSV data, or give an error.
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
$$$ hledger check -f csvnoinclude.j
|
$$$ hledger check -f csvnoinclude.j
|
||||||
>>>2 /Error: sorry, CSV files can't be included yet
|
>>>2 /CSV files can't be included yet/
|
||||||
/
|
|
||||||
>>>= 1
|
>>>= 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user