예제 #1
0
        /// <summary>
        /// Configures an error processor with the necessary processors.
        /// </summary>
        /// <typeparam name="TErrorRest">Type of the expected error</typeparam>
        /// <typeparam name="TSerializer">Type of the serializer</typeparam>
        /// <param name="errorProcessor">Processor to configure</param>
        /// <returns>Processor configured</returns>
        public static ErrorProcessor <OptionStrict <TErrorRest>, TSerializer> Default <TErrorRest, TSerializer>(
            this ErrorProcessor <OptionStrict <TErrorRest>, TSerializer> errorProcessor)
            where TSerializer : ISerializer
        {
            var tryContentDeserializationProcessor = new TryContentDeserializationProcessor <TErrorRest, TSerializer>();

            errorProcessor.AddProcessors(tryContentDeserializationProcessor);
            return(errorProcessor);
        }
예제 #2
0
        Default <TResult, TError, TRestError, TException, TSerializer>(
            this ExceptionProcessor <TResult, TError, TException, TSerializer> exceptionProcessor,
            IErrorConverterProvider <TError, TRestError> errorConverterProvider)
            where TSerializer : ISerializer
            where TException : Exception
        {
            var errorConverterProcessor = new ErrorConverterProcessor <TError, TRestError, TSerializer>(errorConverterProvider);
            var errorProcessor          = new ErrorProcessor <OptionStrict <TRestError>, TSerializer>().Default();

            exceptionProcessor.AddProcessors(
                errorConverterProcessor.AddProcessors(
                    errorProcessor));

            return(exceptionProcessor);
        }