Skip to content

Commit

Permalink
Print warning message when config file is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinrobot committed Nov 19, 2023
1 parent f0f523b commit d2ffbc5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.vinrobot.mcemote.config;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.NoSuchFileException;
import java.util.LinkedHashSet;
import java.util.Set;

Expand All @@ -25,6 +27,12 @@ public Configuration load() {
try {
LOGGER.info("Loading config");
return this.configuration = service.load();
} catch (final NoSuchFileException e) {
LOGGER.warn("Config file not found: {}", e.getFile());
return this.configuration = service.create();
} catch (final FileNotFoundException e) {
LOGGER.warn("Config file not found");
return this.configuration = service.create();
} catch (final IOException e) {
LOGGER.error("Failed to load config", e);
return this.configuration = service.create();
Expand Down

0 comments on commit d2ffbc5

Please sign in to comment.