Optimized Exception handling for Deleting Accounts in PrivateBank.java
This commit is contained in:
@@ -379,7 +379,7 @@ public class PrivateBank implements Bank, JsonSerializer<Transaction>, JsonDeser
|
|||||||
String filename = directoryName + "/" + account + ".json";
|
String filename = directoryName + "/" + account + ".json";
|
||||||
File file = new File(filename);
|
File file = new File(filename);
|
||||||
if (!file.delete())
|
if (!file.delete())
|
||||||
throw new IOException();
|
throw new IOException("Datei des Accounts: " + account + " konnte nicht richtig gelöscht werden.");
|
||||||
} else {
|
} else {
|
||||||
throw new AccountDoesNotExistException();
|
throw new AccountDoesNotExistException();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user