CloudNet-v2
CloudNet-v2 copied to clipboard
Add more error handling
Some places in the cloud need more error tolerance.
Examples:
- loading of modules (
ModuleDetector
) - loading the configuration
And more things, primarily in the master and the bridge.
Issue-Label Bot is automatically applying the label feature_request
to this issue, with a confidence of 0.88. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
We should consider using the logger to output the errors instead of always doing a printStackTrace. That way we can identify a better error and include a separate message for each error! Here is an example:
Before
/**
* Copy folder
*
* @param name The name of the folder.
*/
public void copyDirectory(String name) {
File file = new File(path, name);
if (file.exists() && file.isDirectory()) {
try {
FileUtility.copyFilesInDirectory(file,
new File("local/templates/" + serverGroup.getName() + NetworkUtils.SLASH_STRING + serverProcess
.getMeta()
.getTemplate()
.getName() + NetworkUtils.SLASH_STRING + name));
} catch (IOException e) {
e.printStackTrace();
}
}
}
After
/**
* Copy folder
*
* @param name The name of the folder.
*/
public void copyDirectory(String name) {
File file = new File(path, name);
if (file.exists() && file.isDirectory()) {
try {
FileUtility.copyFilesInDirectory(file,
new File("local/templates/" + serverGroup.getName() + NetworkUtils.SLASH_STRING + serverProcess
.getMeta()
.getTemplate()
.getName() + NetworkUtils.SLASH_STRING + name));
} catch (IOException e) {
CloudNetWrapper.getInstance().getCloudNetLogging().log(Level.SEVERE, "An unexpected error occurred while copying a folder ", e);
}
}
}