public TaskBatchLoader()

in src/Epam.GraphQL/TaskBatcher/BatchLoader.cs [240:289]


        public TaskBatchLoader(
            Func<IEnumerable<TId>, Task<IDictionary<TId, TItem>>> batchLoad,
            IResolvedChainConfigurationContext configurationContext,
            Func<string> stepNameFactory,
            IProfiler profiler)
            : base()
        {
            _loader = async keys =>
            {
                Task<IDictionary<TId, TItem>>? task = null;
                IDictionary<TId, TItem>? ret = null;

                try
                {
                    task = batchLoad(keys);
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
                {
                    throw new ExecutionError(configurationContext.GetRuntimeError($"Error during resolving field `{stepNameFactory()}`. Batch delegate has thrown an exception. See an inner exception for details.", configurationContext.Resolver), e);
                }

                if (task == null)
                {
                    throw new ExecutionError(configurationContext.GetRuntimeError($"Error during resolving field `{stepNameFactory()}`. Batch delegate has returned null.", configurationContext.Resolver));
                }

                try
                {
                    ret = await task.ConfigureAwait(false);
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
                {
                    throw new ExecutionError(configurationContext.GetRuntimeError($"Error during resolving field `{stepNameFactory()}`. Batch delegate has thrown an exception. See an inner exception for details.", configurationContext.Resolver), e);
                }

                if (ret == null)
                {
                    throw new ExecutionError(configurationContext.GetRuntimeError($"Error during resolving field `{stepNameFactory()}`. Batch delegate has returned null dictionary.", configurationContext.Resolver));
                }

                return ret;
            };

            _stepNameFactory = stepNameFactory;
            _profiler = profiler;
        }