Skip to content

Exception handling in SettingsService #1731

@jp-weber

Description

@jp-weber

Currently possible exceptions are not directly handled and caught in the SettingsService. Would it be better to handle them here?

example Settings/Adapters/LocalFileSettingsAdapter.cs
new

        public (bool successful, string result) ReadString(string key)
        {
            if (_container.Values.ContainsKey(key))
            {
                return (true, _container.Values[key].ToString());
            }
            else
            {
                return (false, string.Empty);
            }
        }

old

public string ReadString(string key)
            => _container.Values[key].ToString();

I have already implemented many things in my fork:
https://github.com/jp-weber/Template10/tree/master/Source/Template10.Extras/Services/Settings

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