Exemplo n.º 1
0
        /// <summary>
        /// Creates the exception response.
        /// </summary>
        /// <param name="handler">The handler.</param>
        /// <param name="exception">The exception.</param>
        /// <returns>A Response.</returns>
        protected virtual Response CreateExceptionResponse(IRequestHandler handler, Exception exception)
        {
            var response = handler.CreateDefaultResponse();

            response.Exception = new ExceptionInfo(exception);
            SetExceptionType(response, exception);
            return(response);
        }
        private Type TryBasedOnRequestHandler(RequestProcessingContext context)
        {
            IRequestHandler handler = null;

            try
            {
                handler = (IRequestHandler)IoC.Container.Resolve(GetRequestHandlerTypeFor(context.Request));
                return(handler.CreateDefaultResponse().GetType());
            }
            catch
            {
                return(null);
            }
            finally
            {
                if (handler != null)
                {
                    IoC.Container.Release(handler);
                }
            }
        }
Exemplo n.º 3
0
 protected virtual Response CreateExceptionResponse(IRequestHandler handler, Exception exception)
 {
     var response = handler.CreateDefaultResponse();
     response.Exception = new ExceptionInfo(exception);
     SetExceptionType(response, exception);
     return response;
 }