Skip to content

Clarify thrown Exceptions in SessionSettingsΒ #378

@chrjohn

Description

@chrjohn

E.g. there is

public boolean getBool(SessionID sessionID, String key) throws ConfigError, FieldConvertError {
try {
return BooleanConverter.convert(getString(sessionID, key));
} catch (final FieldConvertError e) {
throw new ConfigError(e);
}
}

but FieldConvertError is never thrown but wrapped into ConfigError.

Then there is

public int getInt(SessionID sessionID, String key) throws ConfigError, FieldConvertError {
try {
return Integer.parseInt(getString(sessionID, key));
} catch (final NumberFormatException e) {
throw new FieldConvertError(e.getMessage());
}
}

where ConfigError could be thrown by getString.

I think getBool (and other methods that have this behaviour) should be changed to not mask the FieldConvertError so that it is clear whether there is a problem with the key (i.e. setting was not found) or the value (i.e. value could not be converted).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions