Can't catch YamlConfiguration.loadConfiguration() internal exceptions

Discussion in 'Plugin Development' started by colmalle, Jul 24, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    colmalle

    I have a custom config which uses
    Code:
    this.config = YamlConfiguration.loadConfiguration(configFile);
    to get the FileConfiguration from File. I have deliberately have this config:
    Code:
    hello:
      ==: Recipe
      combine1:
        ==: org.bukkit.inventory.ItemStack
        type: IRON_INGOT
      combine2:
        ==: org.bukkit.inventory.ItemStack
        type: GOLD_INGOT
      result:
        ==: org.bukkit.inventory.ItemStack
        type: DIAMON # <- I know that's the problem
    
    
    to check what happens when someone puts wrong materials. and when I tried running the plugin with try/catch surrounding like so
    Code:
    try {
                this.config = YamlConfiguration.loadConfiguration(configFile);
            } catch (Exception e) {
                System.out.println("Error: " + e.getClass());
            }
    
    I still get an exception that I cant catch but from the same method the config still returns and I can change it.
    I don't want the it to print the internal exceptions because I want to check and correct those later.

    Stacktrace: https://pastebin.com/3XQhP1RA
     
    Last edited by a moderator: Jul 24, 2020
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    colmalle

    So there is no way to catch it or even stop it from logging?
     
  4. Online

    timtower Administrator Administrator Moderator

    Maybe if you manage to hook into the logger.
     
Thread Status:
Not open for further replies.

Share This Page