Merge pull request #18876 from rjernst/plugin_install_unknown
Emit nicer error message when trying to install unknown plugin
This commit is contained in:
commit
9c65bd4ac4
|
@ -237,6 +237,10 @@ class InstallPluginCommand extends SettingCommand {
|
|||
}
|
||||
|
||||
// fall back to plain old URL
|
||||
if (pluginId.contains("://") == false) {
|
||||
// definitely not a valid url, so assume it is a plugin name
|
||||
throw new UserError(ExitCodes.USAGE, "Unknown plugin " + pluginId);
|
||||
}
|
||||
terminal.println("-> Downloading " + URLDecoder.decode(pluginId, "UTF-8"));
|
||||
return downloadZip(terminal, pluginId, tmpDir);
|
||||
}
|
||||
|
|
|
@ -307,6 +307,12 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|||
assertTrue(e.getMessage(), e.getMessage().contains("no protocol"));
|
||||
}
|
||||
|
||||
public void testUnknownPlugin() throws Exception {
|
||||
Tuple<Path, Environment> env = createEnv(fs, temp);
|
||||
UserError e = expectThrows(UserError.class, () -> installPlugin("foo", env.v1()));
|
||||
assertTrue(e.getMessage(), e.getMessage().contains("Unknown plugin foo"));
|
||||
}
|
||||
|
||||
public void testPluginsDirMissing() throws Exception {
|
||||
Tuple<Path, Environment> env = createEnv(fs, temp);
|
||||
Files.delete(env.v2().pluginsFile());
|
||||
|
|
Loading…
Reference in New Issue