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

rescue LoadError; abort flow for missing dependencies breaks client applications #240

Closed
parkr opened this issue Jan 14, 2016 · 5 comments
Closed

Comments

@parkr
Copy link
Contributor

parkr commented Jan 14, 2016

Just left a comment in #80 (comment), but wanted to surface it in a new issue. Ever since a0acb69 was released, it became impossible for client applications to handle missing dependencies. If you're a rails app using this and you don't have a dependency that someone is looking for, your process will abort, which is not going to make your users happy.

raise-ing an error generally returns a 1 exit code. Why is abort necessary?

Real-life example: gjtorikian/jekyll-html-pipeline#7 (comment)

/cc @jch @simeonwillbanks who collaborated on #80.

@jch
Copy link
Contributor

jch commented Jan 14, 2016

The reasoning for abort is we want to fail early with a custom error message explaining what the developer needs to do. The alternative is that the dependency is not met, and the load error is raised, which was confusing.

More background in my reply in gjtorikian/jekyll-html-pipeline#7 (comment)

@parkr
Copy link
Contributor Author

parkr commented Jan 14, 2016

we want to fail early with a custom error message explaining what the developer needs to do.

From what I saw, this was accomplished with a custom require.

The alternative is that the dependency is not met, and the load error is raised, which was confusing.

The custom load message made sense to me. Are you saying the default behaviour of showing the stacktrace is confusing? I agree it can sometimes be too much information, but generally users know to look at the top of the blob they get back for info.

@jch
Copy link
Contributor

jch commented Jan 14, 2016

generally users know to look at the top of the blob they get back for info.

I agree with ya, but that still didn't help with the issues people were filing. We also documented it in the readme https://github.com/jch/html-pipeline#dependencies. Even with this custom message, it's not ideal because we don't check against specific versions of the dependency, so there's unexpected failures if someone has an old gem too.

@parkr
Copy link
Contributor Author

parkr commented Jan 14, 2016

@jch Is there any way to modify the behaviour while still using errors? abort in a library makes it really difficult to work with that library, especially when filters are required dynamically.

@jch
Copy link
Contributor

jch commented Jan 14, 2016

Why is abort necessary?

@parkr sorry, I missed your original point ^^ You're totally right that we don't need abort. Would you or @simeonwillbanks be interested in opening a PR that raises a custom error? It could even use LoadError, but just customize the message.

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