Show an error message if installing a plugin fails #9218
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #9160
Error message will look like this:
Initial error message suggested to just add the plugin to the
PluginsInstalled
list to hide the message but this is wrong since most likely the plugin is not installed yet. Many users won't know whether the plugin is already installed or not. Therefore we are rather recommending to disable the plugin.I was thinking about using a translation there but as such an error occurs very early in the bootstrapping. The translations won't be loaded yet and we cannot even load plugin translations safely as there might be problems with plugins etc. to load correct language. Some day it would be nice to make this error message understandable in a way that someone doesn't have to understand the language. Eg with a Github-like diff with red and green colors and an arrow etc :) Such an error should occur rarely though so it might be ok like this for now.
Initially I wanted to show a notification when the plugin fails to install but this is not trivial as such an error occurs early in the bootstrapping. Notifications require a session and at this point the sessions are not yet loaded and we don't even know if the system is supposed to or even can start a session. Plugins are installed during
FrontController::init
and we don't know whether we are in a CLI mode, API call etc. Safest way is to let the error handler take care of it which makes sure to format the error message in a correct way (eg in an API call it will format the API error message).Even saving all plugins installed error messages temporarily and outputting them later in
dispatch
is not safe since we don't know whether this method will be called and there might be nested dispatch calls which can lead to errors etc.