Exemplo n.º 1
0
        /// <summary>
        /// get (the) response for...
        /// </summary>
        /// <param name="theException">the exception</param>
        /// <param name="useLoggingScope">use (the) logging scope</param>
        /// <returns>the currently running task containing the http response message</returns>
        public async Task <HttpResponseMessage> GetResponseFor(Exception theException, IScopeLoggingContext useLoggingScope)
        {
            if (_faultMap.ContainsKey(theException.GetType()))
            {
                await InformOn(theException, useLoggingScope);

                return(_faultMap[theException.GetType()].Invoke(theException));
            }

            await useLoggingScope.ExceptionDetail(theException);

            return(UnknownError(theException));
        }
        /// <summary>
        /// get (the) response for...
        /// </summary>
        /// <param name="theException">the exception</param>
        /// <param name="theMethod">the type of method</param>
        /// <param name="useLoggingScope">use (the) logging scope</param>
        /// <returns>the currently running task containing the http response message</returns>
        public async Task <HttpResponseMessage> GetResponseFor(Exception theException, TypeOfFunction theMethod, IScopeLoggingContext useLoggingScope)
        {
            var exceptionType = theException.GetType();

            if (_methodMap[theMethod].ContainsKey(exceptionType))
            {
                await InformOn(theException, useLoggingScope);

                return(_methodMap[theMethod][exceptionType].Invoke(theException));
            }

            await useLoggingScope.ExceptionDetail(theException);

            return(_methodMap[theMethod][typeof(FallbackActionException)].Invoke(theException));
        }