mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 17:22:51 +08:00
Plugins: Improve grafana-cli UX + API response messaging for plugin install incompatibility scenario (#36556)
* improve UX for plugin install incompatability * refactor test
This commit is contained in:
@ -387,8 +387,9 @@ func (hs *HTTPServer) InstallPlugin(c *models.ReqContext, dto dtos.InstallPlugin
|
||||
if errors.As(err, &versionNotFoundErr) {
|
||||
return response.Error(http.StatusNotFound, "Plugin version not found", err)
|
||||
}
|
||||
if errors.Is(err, installer.ErrPluginNotFound) {
|
||||
return response.Error(http.StatusNotFound, "Plugin not found", err)
|
||||
var clientError installer.Response4xxError
|
||||
if errors.As(err, &clientError) {
|
||||
return response.Error(clientError.StatusCode, clientError.Message, err)
|
||||
}
|
||||
if errors.Is(err, plugins.ErrInstallCorePlugin) {
|
||||
return response.Error(http.StatusForbidden, "Cannot install or change a Core plugin", err)
|
||||
|
Reference in New Issue
Block a user