瀏覽代碼

Refactored handling of unexpected errors

Sebastian Stenzel 5 年之前
父節點
當前提交
7fc5b1e55f
共有 22 個文件被更改,包括 188 次插入380 次删除
  1. 0 48
      main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/AddVaultGenericErrorController.java
  2. 2 35
      main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/AddVaultModule.java
  3. 5 7
      main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java
  4. 5 7
      main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java
  5. 7 16
      main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java
  6. 40 0
      main/ui/src/main/java/org/cryptomator/ui/common/ErrorComponent.java
  7. 45 0
      main/ui/src/main/java/org/cryptomator/ui/common/ErrorController.java
  8. 45 0
      main/ui/src/main/java/org/cryptomator/ui/common/ErrorModule.java
  9. 3 4
      main/ui/src/main/java/org/cryptomator/ui/common/FXMLLoaderFactory.java
  10. 1 3
      main/ui/src/main/java/org/cryptomator/ui/common/FxmlFile.java
  11. 0 28
      main/ui/src/main/java/org/cryptomator/ui/common/StackTraceController.java
  12. 2 1
      main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplicationModule.java
  13. 0 29
      main/ui/src/main/java/org/cryptomator/ui/migration/MigrationGenericErrorController.java
  14. 2 30
      main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java
  15. 5 7
      main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java
  16. 5 7
      main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockController.java
  17. 0 29
      main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockGenericErrorController.java
  18. 0 32
      main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockModule.java
  19. 0 27
      main/ui/src/main/resources/fxml/addvault_generic_error.fxml
  20. 21 6
      main/ui/src/main/resources/fxml/stacktrace.fxml
  21. 0 32
      main/ui/src/main/resources/fxml/migration_generic_error.fxml
  22. 0 32
      main/ui/src/main/resources/fxml/unlock_generic_error.fxml

+ 0 - 48
main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/AddVaultGenericErrorController.java

@@ -1,48 +0,0 @@
-package org.cryptomator.ui.addvaultwizard;
-
-import javafx.beans.binding.BooleanBinding;
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.ReadOnlyObjectProperty;
-import javafx.fxml.FXML;
-import javafx.scene.Scene;
-import javafx.stage.Stage;
-import org.cryptomator.ui.common.FxController;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@AddVaultWizardScoped
-public class AddVaultGenericErrorController implements FxController {
-
-	private final Stage window;
-	private final ReadOnlyObjectProperty<Scene> previousScene;
-	private final BooleanBinding returnToPreviousSceneAllowed;
-
-	@Inject
-	AddVaultGenericErrorController(@AddVaultWizardWindow Stage window, @Named("genericErrorReturnScene") ObjectProperty<Scene> previousScene) {
-		this.window = window;
-		this.previousScene = previousScene;
-		this.returnToPreviousSceneAllowed = previousScene.isNotNull();
-	}
-
-	@FXML
-	public void back() {
-		assert previousScene.get() != null; // otherwise button should be disabled
-		window.setScene(previousScene.get());
-	}
-
-	@FXML
-	public void close(){
-		window.close();
-	}
-
-	/* Getter/Setter */
-
-	public BooleanBinding returnToPreviousSceneAllowedProperty() {
-		return returnToPreviousSceneAllowed;
-	}
-
-	public boolean isReturnToPreviousSceneAllowed() {
-		return returnToPreviousSceneAllowed.get();
-	}
-}

+ 2 - 35
main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/AddVaultModule.java

@@ -21,7 +21,6 @@ import org.cryptomator.ui.common.FxmlFile;
 import org.cryptomator.ui.common.FxmlScene;
 import org.cryptomator.ui.common.NewPasswordController;
 import org.cryptomator.ui.common.PasswordStrengthUtil;
-import org.cryptomator.ui.common.StackTraceController;
 import org.cryptomator.ui.mainwindow.MainWindow;
 import org.cryptomator.ui.recoverykey.RecoveryKeyDisplayController;
 
@@ -62,20 +61,6 @@ public abstract class AddVaultModule {
 		return stage;
 	}
 
-	@Provides
-	@Named("genericErrorCause")
-	@AddVaultWizardScoped
-	static ObjectProperty<Throwable> provideGenericErrorCause() {
-		return new SimpleObjectProperty<>();
-	}
-
-	@Provides
-	@Named("genericErrorReturnScene")
-	@AddVaultWizardScoped
-	static ObjectProperty<Scene> provideGenericErrorReturnScene() {
-		return new SimpleObjectProperty<>();
-	}
-
 	@Provides
 	@AddVaultWizardScoped
 	static ObjectProperty<Path> provideVaultPath() {
@@ -118,14 +103,7 @@ public abstract class AddVaultModule {
 	static Scene provideChooseExistingVaultScene(@AddVaultWizardWindow FXMLLoaderFactory fxmlLoaders) {
 		return fxmlLoaders.createScene(FxmlFile.ADDVAULT_EXISTING.getRessourcePathString());
 	}
-
-	@Provides
-	@FxmlScene(FxmlFile.ADDVAULT_GENERIC_ERROR)
-	@AddVaultWizardScoped
-	static Scene provideGenericErrorScene(@AddVaultWizardWindow FXMLLoaderFactory fxmlLoaders) {
-		return fxmlLoaders.createScene(FxmlFile.ADDVAULT_GENERIC_ERROR.getRessourcePathString());
-	}
-
+	
 	@Provides
 	@FxmlScene(FxmlFile.ADDVAULT_NEW_NAME)
 	@AddVaultWizardScoped
@@ -211,16 +189,5 @@ public abstract class AddVaultModule {
 	@IntoMap
 	@FxControllerKey(AddVaultSuccessController.class)
 	abstract FxController bindAddVaultSuccessController(AddVaultSuccessController controller);
-
-	@Binds
-	@IntoMap
-	@FxControllerKey(AddVaultGenericErrorController.class)
-	abstract FxController bindAddVaultGenericErrorController(AddVaultGenericErrorController controller);
-
-	@Provides
-	@IntoMap
-	@FxControllerKey(StackTraceController.class)
-	static FxController provideStackTraceController(@Named("genericErrorCause") ObjectProperty<Throwable> errorCause) {
-		return new StackTraceController(errorCause.get());
-	}
+	
 }

+ 5 - 7
main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java

@@ -8,6 +8,7 @@ import javafx.stage.FileChooser;
 import javafx.stage.Stage;
 import org.cryptomator.common.vaults.Vault;
 import org.cryptomator.common.vaults.VaultListManager;
+import org.cryptomator.ui.common.ErrorComponent;
 import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.common.FxmlFile;
 import org.cryptomator.ui.common.FxmlScene;
@@ -29,20 +30,18 @@ public class ChooseExistingVaultController implements FxController {
 	private final Stage window;
 	private final Lazy<Scene> welcomeScene;
 	private final Lazy<Scene> successScene;
-	private final Lazy<Scene> genericErrorScene;
-	private final ObjectProperty<Throwable> genericErrorCause;
+	private final ErrorComponent.Builder errorComponent;
 	private final ObjectProperty<Path> vaultPath;
 	private final ObjectProperty<Vault> vault;
 	private final VaultListManager vaultListManager;
 	private final ResourceBundle resourceBundle;
 
 	@Inject
-	ChooseExistingVaultController(@AddVaultWizardWindow Stage window, @FxmlScene(FxmlFile.ADDVAULT_WELCOME) Lazy<Scene> welcomeScene, @FxmlScene(FxmlFile.ADDVAULT_SUCCESS) Lazy<Scene> successScene, @FxmlScene(FxmlFile.ADDVAULT_GENERIC_ERROR) Lazy<Scene> genericErrorScene, @Named("genericErrorCause") ObjectProperty<Throwable> genericErrorCause, ObjectProperty<Path> vaultPath, @AddVaultWizardWindow ObjectProperty<Vault> vault, VaultListManager vaultListManager, ResourceBundle resourceBundle) {
+	ChooseExistingVaultController(@AddVaultWizardWindow Stage window, @FxmlScene(FxmlFile.ADDVAULT_WELCOME) Lazy<Scene> welcomeScene, @FxmlScene(FxmlFile.ADDVAULT_SUCCESS) Lazy<Scene> successScene, ErrorComponent.Builder errorComponent, ObjectProperty<Path> vaultPath, @AddVaultWizardWindow ObjectProperty<Vault> vault, VaultListManager vaultListManager, ResourceBundle resourceBundle) {
 		this.window = window;
 		this.welcomeScene = welcomeScene;
 		this.successScene = successScene;
-		this.genericErrorScene = genericErrorScene;
-		this.genericErrorCause = genericErrorCause;
+		this.errorComponent = errorComponent;
 		this.vaultPath = vaultPath;
 		this.vault = vault;
 		this.vaultListManager = vaultListManager;
@@ -68,8 +67,7 @@ public class ChooseExistingVaultController implements FxController {
 				window.setScene(successScene.get());
 			} catch (NoSuchFileException e) {
 				LOG.error("Failed to open existing vault.", e);
-				genericErrorCause.set(e);
-				window.setScene(genericErrorScene.get());
+				errorComponent.cause(e).window(window).returnToScene(window.getScene()).build().showErrorScene();
 			}
 		}
 	}

File diff suppressed because it is too large
+ 5 - 7
main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java


File diff suppressed because it is too large
+ 7 - 16
main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java


+ 40 - 0
main/ui/src/main/java/org/cryptomator/ui/common/ErrorComponent.java

@@ -0,0 +1,40 @@
+package org.cryptomator.ui.common;
+
+import dagger.BindsInstance;
+import dagger.Subcomponent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+import javax.annotation.Nullable;
+
+@Subcomponent(modules = {ErrorModule.class})
+public interface ErrorComponent {
+
+	Stage window();
+
+	@FxmlScene(FxmlFile.ERROR)
+	Scene scene();
+
+	default void showErrorScene() {
+		Stage stage = window();
+		stage.setScene(scene());
+		stage.show();
+	}
+	
+	@Subcomponent.Builder
+	interface Builder {
+		
+		@BindsInstance
+		Builder cause(Throwable cause);
+		
+		@BindsInstance
+		Builder window(Stage window);
+		
+		@BindsInstance
+		Builder returnToScene(@Nullable Scene previousScene);
+
+		ErrorComponent build();
+		
+	}
+
+}

+ 45 - 0
main/ui/src/main/java/org/cryptomator/ui/common/ErrorController.java

@@ -0,0 +1,45 @@
+package org.cryptomator.ui.common;
+
+import javafx.fxml.FXML;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+import javax.annotation.Nullable;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public class ErrorController implements FxController {
+
+	private final String stackTrace;
+	private final Scene previousScene;
+	private final Stage window;
+
+	@Inject
+	ErrorController(@Named("stackTrace") String stackTrace, @Nullable Scene previousScene, Stage window) {
+		this.stackTrace = stackTrace;
+		this.previousScene = previousScene;
+		this.window = window;
+	}
+
+	@FXML
+	public void back() {
+		if (previousScene != null) {
+			window.setScene(previousScene);
+		}
+	}
+
+	@FXML
+	public void close() {
+		window.close();
+	}
+
+	/* Getter/Setter */
+	
+	public boolean isPreviousScenePresent() {
+		return previousScene != null;
+	}
+
+	public String getStackTrace() {
+		return stackTrace;
+	}
+}

+ 45 - 0
main/ui/src/main/java/org/cryptomator/ui/common/ErrorModule.java

@@ -0,0 +1,45 @@
+package org.cryptomator.ui.common;
+
+import dagger.Binds;
+import dagger.Module;
+import dagger.Provides;
+import dagger.multibindings.IntoMap;
+import javafx.scene.Scene;
+
+import javax.inject.Named;
+import javax.inject.Provider;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+@Module
+abstract class ErrorModule {
+
+	@Provides
+	static FXMLLoaderFactory provideFxmlLoaderFactory(Map<Class<? extends FxController>, Provider<FxController>> factories, DefaultSceneFactory sceneFactory, ResourceBundle resourceBundle) {
+		return new FXMLLoaderFactory(factories, sceneFactory, resourceBundle);
+	}
+	
+	@Provides
+	@Named("stackTrace")
+	static String provideStackTrace(Throwable cause) {
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		cause.printStackTrace(new PrintStream(baos));
+		return baos.toString(StandardCharsets.UTF_8);
+	}
+
+	@Binds
+	@IntoMap
+	@FxControllerKey(ErrorController.class)
+	abstract FxController bindErrorController(ErrorController controller);
+
+	@Provides
+	@FxmlScene(FxmlFile.ERROR)
+	static Scene provideErrorScene(FXMLLoaderFactory fxmlLoaders) {
+		return fxmlLoaders.createScene(FxmlFile.ERROR.getRessourcePathString());
+	}
+
+
+}

+ 3 - 4
main/ui/src/main/java/org/cryptomator/ui/common/FXMLLoaderFactory.java

@@ -1,6 +1,5 @@
 package org.cryptomator.ui.common;
 
-import com.google.common.base.Splitter;
 import javafx.fxml.FXMLLoader;
 import javafx.scene.Parent;
 import javafx.scene.Scene;
@@ -9,7 +8,6 @@ import javax.inject.Provider;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UncheckedIOException;
-import java.util.List;
 import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.function.Function;
@@ -65,8 +63,9 @@ public class FXMLLoaderFactory {
 			throw new UncheckedIOException("Failed to load " + fxmlResourceName, e);
 		}
 		Parent root = loader.getRoot();
-		List<String> addtionalStyleSheets = Splitter.on(',').omitEmptyStrings().splitToList(resourceBundle.getString("additionalStyleSheets"));
-		addtionalStyleSheets.forEach(styleSheet -> root.getStylesheets().add("/css/" + styleSheet));
+		// TODO: discuss if we can remove language-specific stylesheets
+		// List<String> addtionalStyleSheets = Splitter.on(',').omitEmptyStrings().splitToList(resourceBundle.getString("additionalStyleSheets"));
+		// addtionalStyleSheets.forEach(styleSheet -> root.getStylesheets().add("/css/" + styleSheet));
 		return sceneFactory.apply(root);
 	}
 

+ 1 - 3
main/ui/src/main/java/org/cryptomator/ui/common/FxmlFile.java

@@ -2,7 +2,6 @@ package org.cryptomator.ui.common;
 
 public enum FxmlFile {
 	ADDVAULT_EXISTING("/fxml/addvault_existing.fxml"), //
-	ADDVAULT_GENERIC_ERROR("/fxml/addvault_generic_error.fxml"),
 	ADDVAULT_NEW_NAME("/fxml/addvault_new_name.fxml"), //
 	ADDVAULT_NEW_LOCATION("/fxml/addvault_new_location.fxml"), //
 	ADDVAULT_NEW_PASSWORD("/fxml/addvault_new_password.fxml"), //
@@ -10,10 +9,10 @@ public enum FxmlFile {
 	ADDVAULT_SUCCESS("/fxml/addvault_success.fxml"), //
 	ADDVAULT_WELCOME("/fxml/addvault_welcome.fxml"), //
 	CHANGEPASSWORD("/fxml/changepassword.fxml"), //
+	ERROR("/fxml/error.fxml"), //
 	FORGET_PASSWORD("/fxml/forget_password.fxml"), //
 	MAIN_WINDOW("/fxml/main_window.fxml"), //
 	MIGRATION_CAPABILITY_ERROR("/fxml/migration_capability_error.fxml"), //
-	MIGRATION_GENERIC_ERROR("/fxml/migration_generic_error.fxml"), //
 	MIGRATION_RUN("/fxml/migration_run.fxml"), //
 	MIGRATION_START("/fxml/migration_start.fxml"), //
 	MIGRATION_SUCCESS("/fxml/migration_success.fxml"), //
@@ -25,7 +24,6 @@ public enum FxmlFile {
 	RECOVERYKEY_SUCCESS("/fxml/recoverykey_success.fxml"), //
 	REMOVE_VAULT("/fxml/remove_vault.fxml"), //
 	UNLOCK("/fxml/unlock.fxml"),
-	UNLOCK_GENERIC_ERROR("/fxml/unlock_generic_error.fxml"), //
 	UNLOCK_INVALID_MOUNT_POINT("/fxml/unlock_invalid_mount_point.fxml"), //
 	UNLOCK_SUCCESS("/fxml/unlock_success.fxml"), //
 	VAULT_OPTIONS("/fxml/vault_options.fxml"), //

+ 0 - 28
main/ui/src/main/java/org/cryptomator/ui/common/StackTraceController.java

@@ -1,28 +0,0 @@
-package org.cryptomator.ui.common;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.nio.charset.StandardCharsets;
-
-public class StackTraceController implements FxController {
-
-	private final String stackTrace;
-
-	public StackTraceController(Throwable cause) {
-		this.stackTrace = provideStackTrace(cause);
-	}
-
-	private static String provideStackTrace(Throwable cause) {
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		cause.printStackTrace(new PrintStream(baos));
-		return baos.toString(StandardCharsets.UTF_8);
-	}
-
-	/* Getter/Setter */
-
-	public String getStackTrace() {
-		return stackTrace;
-	}
-
-
-}

+ 2 - 1
main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplicationModule.java

@@ -14,6 +14,7 @@ import javafx.beans.property.SimpleObjectProperty;
 import javafx.scene.image.Image;
 import org.apache.commons.lang3.SystemUtils;
 import org.cryptomator.common.vaults.Vault;
+import org.cryptomator.ui.common.ErrorComponent;
 import org.cryptomator.ui.mainwindow.MainWindowComponent;
 import org.cryptomator.ui.preferences.PreferencesComponent;
 import org.cryptomator.ui.quit.QuitComponent;
@@ -26,7 +27,7 @@ import java.io.UncheckedIOException;
 import java.util.Collections;
 import java.util.List;
 
-@Module(includes = {UpdateCheckerModule.class}, subcomponents = {MainWindowComponent.class, PreferencesComponent.class, UnlockComponent.class, QuitComponent.class})
+@Module(includes = {UpdateCheckerModule.class}, subcomponents = {MainWindowComponent.class, PreferencesComponent.class, UnlockComponent.class, QuitComponent.class, ErrorComponent.class})
 abstract class FxApplicationModule {
 
 	@Provides

+ 0 - 29
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationGenericErrorController.java

@@ -1,29 +0,0 @@
-package org.cryptomator.ui.migration;
-
-import dagger.Lazy;
-import javafx.fxml.FXML;
-import javafx.scene.Scene;
-import javafx.stage.Stage;
-import org.cryptomator.ui.common.FxController;
-import org.cryptomator.ui.common.FxmlFile;
-import org.cryptomator.ui.common.FxmlScene;
-
-import javax.inject.Inject;
-
-@MigrationScoped
-public class MigrationGenericErrorController implements FxController {
-
-	private final Stage window;
-	private final Lazy<Scene> startScene;
-
-	@Inject
-	MigrationGenericErrorController(@MigrationWindow Stage window, @FxmlScene(FxmlFile.MIGRATION_START) Lazy<Scene> startScene) {
-		this.window = window;
-		this.startScene = startScene;
-	}
-
-	@FXML
-	public void back() {
-		window.setScene(startScene.get());
-	}
-}

+ 2 - 30
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationModule.java

@@ -17,7 +17,6 @@ import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.common.FxControllerKey;
 import org.cryptomator.ui.common.FxmlFile;
 import org.cryptomator.ui.common.FxmlScene;
-import org.cryptomator.ui.common.StackTraceController;
 import org.cryptomator.ui.mainwindow.MainWindow;
 
 import javax.inject.Named;
@@ -48,14 +47,7 @@ abstract class MigrationModule {
 		stage.getIcons().addAll(windowIcons);
 		return stage;
 	}
-
-	@Provides
-	@Named("genericErrorCause")
-	@MigrationScoped
-	static ObjectProperty<Throwable> provideGenericErrorCause() {
-		return new SimpleObjectProperty<>();
-	}
-
+	
 	@Provides
 	@Named("capabilityErrorCause")
 	@MigrationScoped
@@ -91,14 +83,6 @@ abstract class MigrationModule {
 		return fxmlLoaders.createScene("/fxml/migration_capability_error.fxml");
 	}
 
-	@Provides
-	@FxmlScene(FxmlFile.MIGRATION_GENERIC_ERROR)
-	@MigrationScoped
-	static Scene provideMigrationGenericErrorScene(@MigrationWindow FXMLLoaderFactory fxmlLoaders) {
-		return fxmlLoaders.createScene("/fxml/migration_generic_error.fxml");
-	}
-
-
 	// ------------------
 
 	@Binds
@@ -120,17 +104,5 @@ abstract class MigrationModule {
 	@IntoMap
 	@FxControllerKey(MigrationCapabilityErrorController.class)
 	abstract FxController bindMigrationCapabilityErrorController(MigrationCapabilityErrorController controller);
-
-	@Binds
-	@IntoMap
-	@FxControllerKey(MigrationGenericErrorController.class)
-	abstract FxController bindMigrationGenericErrorController(MigrationGenericErrorController controller);
-
-	@Provides
-	@IntoMap
-	@FxControllerKey(StackTraceController.class)
-	static FxController provideStackTraceController(@Named("genericErrorCause") ObjectProperty<Throwable> errorCause) {
-		return new StackTraceController(errorCause.get());
-	}
-
+	
 }

File diff suppressed because it is too large
+ 5 - 7
main/ui/src/main/java/org/cryptomator/ui/migration/MigrationRunController.java


File diff suppressed because it is too large
+ 5 - 7
main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockController.java


+ 0 - 29
main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockGenericErrorController.java

@@ -1,29 +0,0 @@
-package org.cryptomator.ui.unlock;
-
-import dagger.Lazy;
-import javafx.fxml.FXML;
-import javafx.scene.Scene;
-import javafx.stage.Stage;
-import org.cryptomator.ui.common.FxController;
-import org.cryptomator.ui.common.FxmlFile;
-import org.cryptomator.ui.common.FxmlScene;
-
-import javax.inject.Inject;
-
-@UnlockScoped
-public class UnlockGenericErrorController implements FxController {
-
-	private final Stage window;
-	private final Lazy<Scene> unlockScene;
-
-	@Inject
-	UnlockGenericErrorController(@UnlockWindow Stage window, @FxmlScene(FxmlFile.UNLOCK) Lazy<Scene> unlockScene) {
-		this.window = window;
-		this.unlockScene = unlockScene;
-	}
-
-	@FXML
-	public void back() {
-		window.setScene(unlockScene.get());
-	}
-}

+ 0 - 32
main/ui/src/main/java/org/cryptomator/ui/unlock/UnlockModule.java

@@ -4,8 +4,6 @@ import dagger.Binds;
 import dagger.Module;
 import dagger.Provides;
 import dagger.multibindings.IntoMap;
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.SimpleObjectProperty;
 import javafx.scene.Scene;
 import javafx.scene.image.Image;
 import javafx.stage.Modality;
@@ -16,7 +14,6 @@ import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.common.FxControllerKey;
 import org.cryptomator.ui.common.FxmlFile;
 import org.cryptomator.ui.common.FxmlScene;
-import org.cryptomator.ui.common.StackTraceController;
 import org.cryptomator.ui.forgetPassword.ForgetPasswordComponent;
 
 import javax.inject.Named;
@@ -47,13 +44,6 @@ abstract class UnlockModule {
 		return stage;
 	}
 
-	@Provides
-	@Named("genericErrorCause")
-	@UnlockScoped
-	static ObjectProperty<Throwable> provideGenericErrorCause() {
-		return new SimpleObjectProperty<>();
-	}
-
 	@Provides
 	@FxmlScene(FxmlFile.UNLOCK)
 	@UnlockScoped
@@ -75,15 +65,6 @@ abstract class UnlockModule {
 		return fxmlLoaders.createScene("/fxml/unlock_invalid_mount_point.fxml");
 	}
 
-
-	@Provides
-	@FxmlScene(FxmlFile.UNLOCK_GENERIC_ERROR)
-	@UnlockScoped
-	static Scene provideGenericErrorScene(@UnlockWindow FXMLLoaderFactory fxmlLoaders) {
-		return fxmlLoaders.createScene("/fxml/unlock_generic_error.fxml");
-	}
-
-
 	// ------------------
 
 	@Binds
@@ -101,17 +82,4 @@ abstract class UnlockModule {
 	@FxControllerKey(UnlockInvalidMountPointController.class)
 	abstract FxController bindUnlockInvalidMountPointController(UnlockInvalidMountPointController controller);
 
-	@Binds
-	@IntoMap
-	@FxControllerKey(UnlockGenericErrorController.class)
-	abstract FxController bindUnlockGenericErrorController(UnlockGenericErrorController controller);
-
-	@Provides
-	@IntoMap
-	@FxControllerKey(StackTraceController.class)
-	static FxController provideStackTraceController(@Named("genericErrorCause") ObjectProperty<Throwable> errorCause) {
-		return new StackTraceController(errorCause.get());
-	}
-
-
 }

+ 0 - 27
main/ui/src/main/resources/fxml/addvault_generic_error.fxml

@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.geometry.Insets?>
-<?import javafx.scene.control.Button?>
-<?import javafx.scene.control.ButtonBar?>
-<?import javafx.scene.layout.VBox?>
-<VBox xmlns="http://javafx.com/javafx"
-	  xmlns:fx="http://javafx.com/fxml"
-	  fx:controller="org.cryptomator.ui.addvaultwizard.AddVaultGenericErrorController"
-	  prefWidth="450"
-	  prefHeight="450"
-	  spacing="12"
-	  alignment="TOP_CENTER">
-	<padding>
-		<Insets topRightBottomLeft="24"/>
-	</padding>
-	<children>
-		<fx:include source="/fxml/stacktrace.fxml" VBox.vgrow="ALWAYS"/>
-
-		<ButtonBar buttonMinWidth="120" buttonOrder="B+C">
-			<buttons>
-				<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" onAction="#back" visible="${controller.returnToPreviousSceneAllowed}"/>
-				<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" onAction="#close"/>
-			</buttons>
-		</ButtonBar>
-	</children>
-</VBox>

+ 21 - 6
main/ui/src/main/resources/fxml/stacktrace.fxml

@@ -1,17 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<?import javafx.scene.control.Label?>
-<?import javafx.scene.control.TextArea?>
+<?import javafx.geometry.Insets?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.ButtonBar?>
+<?import javafx.scene.layout.VBox?>
 <?import javafx.scene.layout.HBox?>
 <?import javafx.scene.layout.StackPane?>
-<?import javafx.scene.layout.VBox?>
 <?import javafx.scene.shape.Circle?>
 <?import org.cryptomator.ui.controls.FontAwesome5IconView?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.control.TextArea?>
 <VBox xmlns="http://javafx.com/javafx"
 	  xmlns:fx="http://javafx.com/fxml"
-	  fx:controller="org.cryptomator.ui.common.StackTraceController"
-	  minWidth="300"
-	  spacing="12">
+	  fx:controller="org.cryptomator.ui.common.ErrorController"
+	  prefWidth="450"
+	  prefHeight="450"
+	  spacing="12"
+	  alignment="TOP_CENTER">
+	<padding>
+		<Insets topRightBottomLeft="24"/>
+	</padding>
 	<children>
 		<HBox spacing="12" VBox.vgrow="NEVER">
 			<StackPane alignment="CENTER" HBox.hgrow="NEVER">
@@ -25,5 +33,12 @@
 		</HBox>
 
 		<TextArea VBox.vgrow="ALWAYS" text="${controller.stackTrace}" prefRowCount="5" editable="false"/>
+
+		<ButtonBar buttonMinWidth="120" buttonOrder="B+C">
+			<buttons>
+				<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" onAction="#back" visible="${controller.previousScenePresent}"/>
+				<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" onAction="#close" />
+			</buttons>
+		</ButtonBar>
 	</children>
 </VBox>

+ 0 - 32
main/ui/src/main/resources/fxml/migration_generic_error.fxml

@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.geometry.Insets?>
-<?import javafx.scene.control.Button?>
-<?import javafx.scene.control.ButtonBar?>
-<?import javafx.scene.layout.VBox?>
-<?import javafx.scene.layout.Region?>
-<VBox xmlns="http://javafx.com/javafx"
-	  xmlns:fx="http://javafx.com/fxml"
-	  fx:controller="org.cryptomator.ui.migration.MigrationGenericErrorController"
-	  minWidth="400"
-	  maxWidth="400"
-	  minHeight="145"
-	  spacing="12">
-	<padding>
-		<Insets topRightBottomLeft="12"/>
-	</padding>
-	<children>
-		<fx:include source="/fxml/stacktrace.fxml"/>
-
-		<Region VBox.vgrow="ALWAYS"/>
-
-		<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
-			<ButtonBar buttonMinWidth="120" buttonOrder="B+U">
-				<buttons>
-					<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" cancelButton="true" onAction="#back"/>
-					<Region ButtonBar.buttonData="OTHER"/>
-				</buttons>
-			</ButtonBar>
-		</VBox>
-	</children>
-</VBox>

+ 0 - 32
main/ui/src/main/resources/fxml/unlock_generic_error.fxml

@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.geometry.Insets?>
-<?import javafx.scene.control.Button?>
-<?import javafx.scene.control.ButtonBar?>
-<?import javafx.scene.layout.VBox?>
-<?import javafx.scene.layout.Region?>
-<VBox xmlns="http://javafx.com/javafx"
-	  xmlns:fx="http://javafx.com/fxml"
-	  fx:controller="org.cryptomator.ui.unlock.UnlockGenericErrorController"
-	  minWidth="400"
-	  maxWidth="400"
-	  minHeight="145"
-	  spacing="12">
-	<padding>
-		<Insets topRightBottomLeft="12"/>
-	</padding>
-	<children>
-		<fx:include source="/fxml/stacktrace.fxml"/>
-
-		<Region VBox.vgrow="ALWAYS"/>
-
-		<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
-			<ButtonBar buttonMinWidth="120" buttonOrder="B+U">
-				<buttons>
-					<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" cancelButton="true" onAction="#back"/>
-					<Region ButtonBar.buttonData="OTHER"/>
-				</buttons>
-			</ButtonBar>
-		</VBox>
-	</children>
-</VBox>