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

Right. Both of those invariants are good, imo.

As far as letting IO errors leak through, I think you're right. I'm
not sure what made me want to wrap them in the first place.

--
Michael Jackson
@mjackson

On Wed, Feb 22, 2012 at 10:39 PM, Bernard Lambeau

wrote:
> 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.).
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/mjijackson/citrus/commit/2a79ad93874b687736edf71e4948280dd6d91aee#commitcomment-999437