mjijackson/citrus — comment on commit 2a79ad93874b687736edf71e4948280dd6d91aee
File: lib/citrus.rb line 403
By blambeau:

For `:to_path`, sorry I was a bit confused. We have the two following invariants now, which is good, right?

# The initial parsed source, being a Pathname/File/IO/String is
# always preserved when invoking #parse
grammar.parse(anything).source == anything

# The source is always a Pathname when invoking #parse_file.
# +anything+ mut respond to :to_str, the later denoting the path to
# an existing file.
Pathname === grammar.parse_file(anything).source

You're right about consistency of error management, so I'm fine with that too. However, for the next major version, it would be better IMO to let IO errors unchanged everywhere (including in Citrus.load, that is). There is nothing Citrus can do if a file does not exists. Hiding the real cause (Errno::ENOENT) behind a Citrus::Error actually prevents the caller from doing something smart (friendly user message, catching the cause and finding a countermeasure, etc.).