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

Exception handling when loading extensions #6

Open
jchappelle opened this issue Feb 23, 2016 · 2 comments
Open

Exception handling when loading extensions #6

jchappelle opened this issue Feb 23, 2016 · 2 comments

Comments

@jchappelle
Copy link

This is more of a question/observation than an issue.

Should Exceptions in plugins bomb the whole app? Or the page trying to render it? I ask this because in trying to get plugins to work I have hit issues, most of them my own fault in how I am installing the plugin or the plugin itself may be faulty.

I've implemented a facade so I catch the exception and log it instead of throwing. But if someone was using the @Inject annotation then it would cause that page to throw an exception during rendering.

It may be too low of a level to make PluginManager catch this and I'm not sure if PluginComponentInjector could catch it and log it but it's something to think about. It seems most people would want the PluginManager.getExtensions to return an empty list in this case.

Maybe a configurable ExceptionHandler could be added. By default it could throw. Just a thought.

@decebals
Copy link
Member

I don't know what to say. In other project available on Github I used runtime exception and I think that it's not bad.

I reviewed DefaultPluginManager.getExtension() -> AbstractextensionFinder.find(...) and I don't see where and what exception is thrown. All exceptions (non RuntimeException) are logged.

@jchappelle
Copy link
Author

I was referring to RuntimeExceptions. Two of the ones I hit were IllegalArgumentException and FileSystemAlreadyExistsException which I reference here #5.

Hitting these exceptions made the whole page unusable. An app that allows for plugins should guard itself against failures in the plugins. Although I'm not sure it's PF4J's responsibility to do this. Or maybe it is. I just brought it up as a possible improvement to the library.

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