mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
Error handling for plugin installation/uninstallaion
This commit is contained in:
@@ -97,7 +97,16 @@ class MultiPluginActionModal extends React.Component<Props, State> {
|
||||
loading: true
|
||||
});
|
||||
|
||||
apiClient.post(pendingPlugins._links.cancel.href).then(() => this.reload());
|
||||
apiClient
|
||||
.post(pendingPlugins._links.cancel.href)
|
||||
.then(() => this.reload())
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
success: false,
|
||||
loading: false,
|
||||
error: error
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
updateAll = () => {
|
||||
@@ -239,6 +248,7 @@ class MultiPluginActionModal extends React.Component<Props, State> {
|
||||
|
||||
renderBody = () => {
|
||||
const { actionType } = this.props;
|
||||
const { error } = this.state;
|
||||
return (
|
||||
<>
|
||||
<div className="media">
|
||||
@@ -247,6 +257,11 @@ class MultiPluginActionModal extends React.Component<Props, State> {
|
||||
{this.renderModalContent()}
|
||||
</div>
|
||||
</div>
|
||||
{!!error && (
|
||||
<div className="media">
|
||||
<ErrorNotification error={error} />
|
||||
</div>
|
||||
)}
|
||||
{actionType === MultiPluginActionType.EXECUTE_PENDING && (
|
||||
<div className="media">{this.renderNotifications()}</div>
|
||||
)}
|
||||
|
||||
@@ -121,6 +121,7 @@ class PluginModal extends React.Component<Props, State> {
|
||||
.catch(error => {
|
||||
this.setState({
|
||||
loading: false,
|
||||
success: false,
|
||||
error: error
|
||||
});
|
||||
});
|
||||
|
||||
@@ -288,7 +288,7 @@ public class DefaultPluginManager implements PluginManager {
|
||||
pendingInstallQueue.forEach(PendingPluginInstallation::cancel);
|
||||
pendingUninstallQueue.clear();
|
||||
pendingInstallQueue.clear();
|
||||
getInstalled().forEach(p -> p.setUninstallable(isUninstallable(p)));
|
||||
updateMayUninstallFlag();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ class PendingPluginInstallation {
|
||||
Files.delete(file);
|
||||
plugin.cancelInstallation();
|
||||
} catch (IOException ex) {
|
||||
throw new PluginFailedToCancelInstallationException("failed to cancel installation of plugin " + name, ex);
|
||||
throw new PluginFailedToCancelInstallationException("failed to cancel plugin installation ", name, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class PendingPluginUninstallation {
|
||||
Files.delete(uninstallFile);
|
||||
plugin.setMarkedForUninstall(false);
|
||||
} catch (IOException ex) {
|
||||
throw new PluginFailedToCancelInstallationException("failed to cancel uninstallation of plugin " + name, ex);
|
||||
throw new PluginFailedToCancelInstallationException("failed to cancel uninstallation", name, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
package sonia.scm.plugin;
|
||||
|
||||
public class PluginFailedToCancelInstallationException extends RuntimeException {
|
||||
public PluginFailedToCancelInstallationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
import sonia.scm.ExceptionWithContext;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
|
||||
public class PluginFailedToCancelInstallationException extends ExceptionWithContext {
|
||||
public PluginFailedToCancelInstallationException(String message, String name, Exception cause) {
|
||||
super(entity("plugin", name).build(), message, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return "65RdZ5atX1";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,10 @@
|
||||
"40RaYIeeR1": {
|
||||
"displayName": "Es wurden keine Änderungen durchgeführt",
|
||||
"description": "Das Repository wurde nicht verändert. Daher konnte kein neuer Commit erzeugt werden."
|
||||
},
|
||||
"65RdZ5atX1": {
|
||||
"displayName": "Fehler beim Löschen von Plugin-Dateien",
|
||||
"description": "Einige Dateien für die Plugin-Deinstallation konnten nicht gelöscht werden. Dieses kann zu Inkonsistenzen führen, so dass der SCM-Manager nicht mehr korrekt starten kann. Bitte prüfen Sie die Logs und bereinigen Sie das Plugin-Verzeichnis des SCM-Managers manuell."
|
||||
}
|
||||
},
|
||||
"namespaceStrategies": {
|
||||
|
||||
@@ -175,6 +175,10 @@
|
||||
"40RaYIeeR1": {
|
||||
"displayName": "No changes were made",
|
||||
"description": "No changes were made to the files of the repository. Therefor no new commit could be created."
|
||||
},
|
||||
"65RdZ5atX1": {
|
||||
"displayName": "Error removing plugin files",
|
||||
"description": "Some files to cancel the plugin (un)installation could not be deleted. This can lead to inconsistencies so that the SCM-Manager cannot restart properly. Please check the logs and clean up the plugin folder manually."
|
||||
}
|
||||
},
|
||||
"namespaceStrategies": {
|
||||
|
||||
Reference in New Issue
Block a user