Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eating LoadErrors can mask different problems #282

Closed
timdiggins opened this issue Sep 7, 2017 · 3 comments
Closed

Eating LoadErrors can mask different problems #282

timdiggins opened this issue Sep 7, 2017 · 3 comments

Comments

@timdiggins
Copy link
Contributor

I had an incompatible version of nokogiri for sanitize installed in my local Gemfile.lock (for gem development, so not committed to repo).

The sanitization_filter.rb then rescued this LoadError and output the (incorrect) message that there was sanitize was missing dependency.
see: https://github.com/jch/html-pipeline/blob/master/lib/html/pipeline/sanitization_filter.rb#L4

Took me some headscratching to work out what was going wrong.

This has been discussed before:
#160 (comment)

I think it would be a good idea to output (in every case of rescuing the LoadError) the original exceptions message...

Something as simple as the following perhaps? (per file)

begin
  require "sanitize"
rescue LoadError => e
  raise HTML::Pipeline::MissingDependencyError, "Missing dependency (or other LoadError) 'sanitize' for SanitizationFilter. See README.md for details.\n----\n#{e}"
end
@timdiggins
Copy link
Contributor Author

So my point was -- do you need a test for all of these, or would you welcome a PR with just the changes?

@gjtorikian
Copy link
Owner

Just a PR with changes works. 👍

@timdiggins
Copy link
Contributor Author

@gjtorikian I did a spec and a helper method in the end. Felt wrong modifying so many files with same changes and no tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants