Solved YamlConfiguration doesn't activate try/catch block

Discussion in 'Spigot Plugin Development' started by Heretere, May 29, 2016.

  1. Code (Text):
    try {
    YamlConfiguration.loadConfiguration(configStream);
    } catch (Exception e) {
    System.out.println("error in config");
    }
    When there is an error in the config it doesn't seem to activate the try/catch block how would I detect if there is an error in the config file programmatically?
     
  2. I don't think it can detect errors, it will just throw npe's when you try to get the data.
    If you're looking to find errors when reading the data, look into using gson for your configuration.
     
    • Informative Informative x 1
  3. Ah, thank you.