Skip to content

Throw statement in YAMLConfigProvider drops exception on floor #106

@davidmichaelkarr

Description

@davidmichaelkarr

I was tracking an error reported by a developer on our team, and the stacktrace included the exception thrown from the following method in "YAMLConfigProvider":

    public void generateConfig(T config, String filePath) throws ConfigurationException {
        YamlWriter writer;
        try {
            writer = new YamlWriter(new FileWriter(filePath));
            writer.getConfig().setClassTag("Configuration", clazz);
            writer.write(Configuration.DEFAULT);
            writer.close();
        } catch (IOException e) {
            throw new ConfigurationException("Configuration Exception", "CONF_002");
        }
    }

That throw statement is dropping the IOException on the floor, which would likely have had information about what file path was being attempted, and that it doesn't exist (I'm making an educated guess from the circumstances of the error that was reported). This throw statement should be fixed to include the caught exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions