enhancing error handling in storage location selection when creating a new vault

This commit is contained in:
Armin Schrenk
2019-10-09 18:24:23 +02:00
parent d70b7e12ef
commit 4a61fe372e
3 changed files with 5 additions and 7 deletions

View File

@@ -26,10 +26,8 @@ import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.io.IOException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ResourceBundle;
@@ -116,14 +114,12 @@ public class CreateNewVaultLocationController implements FxController {
Files.delete(createdDir); // assert: dir exists and is empty
window.setScene(choosePasswordScene.get());
} catch (FileAlreadyExistsException e) {
LOG.warn("Can not use already existing vault path: {}", vaultPath.get());
LOG.warn("Can not use already existing vault path {}", vaultPath.get());
warningText.set(resourceBundle.getString("addvaultwizard.new.fileAlreadyExists"));
} catch (NoSuchFileException | DirectoryNotEmptyException e) {
LOG.error("Failed to delete recently created directory.", e);
// TODO show generic error text for unexpected exception
} catch (IOException e) {
LOG.warn("Can not create vault at path: {}", vaultPath.get());
// TODO show generic error text for unexpected exception
LOG.warn("Thrown Exception:", e);
warningText.set(resourceBundle.getString("addvaultwizard.new.ioException"));
}
}

View File

@@ -37,6 +37,7 @@ addvaultwizard.new.directoryPickerTitle=Select Directory
addvaultwizard.new.enterPassword=Enter a password for the vault
addvaultwizard.new.fileAlreadyExists=Vault can not be created at this path because some object already exists.
addvaultwizard.new.invalidName=Invalid vault name. Please consider a regular directory name.
addvaultwizard.new.ioException=Selected directory failed a basic test. Make sure to have the appropiate access rights and nothing interferes with Cryptomator.
### Password
addvaultwizard.new.reenterPassword=Confirm the password
addvaultwizard.new.passwordsMatch=Passwords match!

View File

@@ -31,6 +31,7 @@ addvaultwizard.new.locationPrompt=…
addvaultwizard.new.directoryPickerLabel=Eigenen Ort wählen…
addvaultwizard.new.directoryPickerButton=Durchsuchen…
addvaultwizard.new.directoryPickerTitle=Wähle ein Verzeichnis
addvaultwizard.new.ioException=Für das ausgewählte Verzeichnis schlug ein Test fehl. Vergewissere dich, dass du Schreibrechte has und nichts Cryptomator blockiert.
### Password
addvaultwizard.new.enterPassword=Vergib ein Passwort für den Tresor
addvaultwizard.new.fileAlreadyExists=Der Tresor konnte nicht erstellt werden, da der Speicherort bereits belegt ist.