Beispiel #1
0
        Either <ConfigLookupError, A> fetch <A>(
            IDictionary <string, object> current, ConfigPath path, string part, Parser <A> parser
            )
        {
            if (!current.ContainsKey(part))
            {
                return(F.left <ConfigLookupError, A>(ConfigLookupError.keyNotFound(F.lazy(() =>
                                                                                          $"Cannot find part '{part}' from path '{path}' in {current.asDebugString()} " +
                                                                                          $"[{nameof(scope)}='{scope}']"
                                                                                          ))));
            }

            var node = current[part];

            return(parser(path, node));
        }
Beispiel #2
0
        Either <ConfigLookupError, A> fetch <A>(
            IDictionary <string, object> current, ConfigPath path, string part, Parser <A> parser
            )
        {
            if (!current.ContainsKey(part))
            {
                return(F.left <ConfigLookupError, A>(ConfigLookupError.keyNotFound(F.lazy(() => ImmutableArray.Create(
                                                                                              F.t(nameof(part), part),
                                                                                              F.t(nameof(path), path.pathStrWithBase),
                                                                                              F.t(nameof(current), current.asDebugString()),
                                                                                              F.t(nameof(scope), scope.pathStrWithBase)
                                                                                              )))));
            }

            var node = current[part];

            return(parser(path, node));
        }