Last active
February 20, 2024 15:11
-
-
Save mcsee/029e21221849e251babf8d933170e62f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileReader { | |
public static void main(String[] args) { | |
FileReader file = null; | |
try { | |
file = new FileReader("source.txt"); | |
file.read(); | |
} | |
catch(FileException exception) { | |
if (exception.description == | |
(this.expectedMessages() | |
.errorDescriptionFileTemporaryLocked(){ | |
// sleep and retry | |
// IF behavior is the same with all the exceptions | |
// just change the text on | |
// object creation and raise the correct instance | |
} | |
this.showErrorToUser(exception.messageToUser(); | |
// This example is simplified. | |
// You should translate the text | |
} | |
finally { | |
try { | |
file.close(); | |
} catch (IOException ioException) { | |
ioException.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment