File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/main/java/frc/robot/lib/config Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11package frc .robot .lib .config ;
22
3+ import java .io .IOError ;
4+ import java .io .IOException ;
5+ import java .nio .file .Files ;
6+ import java .nio .file .Path ;
7+ import java .nio .file .Paths ;
38import java .util .Optional ;
49import org .tomlj .Toml ;
510import org .tomlj .TomlParseResult ;
@@ -16,9 +21,15 @@ public TomlConfigLoader(String configFile) {
1621
1722 @ Override
1823 public void openConfig () {
19- TomlParseResult result = Toml .parse (mConfigFile );
20- result .errors ().forEach (error -> System .err .println (error .toString ()));
21- mToml = result ;
24+ try {
25+ String file = Files .readString (Path .of (mConfigFile ));
26+ TomlParseResult result = Toml .parse (file );
27+ result .errors ().forEach (error -> System .err .println (error .toString ()));
28+ mToml = result ;
29+ } catch (Exception ex ) {
30+ System .err .println ("Error: unable to read config.toml at " + mConfigFile );
31+ System .exit (1 );
32+ }
2233 }
2334
2435 @ Override
You can’t perform that action at this time.
0 commit comments