Exemplo n.º 1
0
        private static Action <Stream> ProcessBenignException(Exception exception, IDataService service)
        {
            DataServiceException exception2 = exception as DataServiceException;

            if ((exception2 != null) && (exception2.StatusCode == 0x130))
            {
                service.OperationContext.Host.ResponseStatusCode = 0x130;
                return(WebUtil.GetEmptyStreamWriter());
            }
            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Check to see if the given excpetion is a benign one such as statusCode = 304.  If yes we return an action that can
        /// serialize the exception into a stream.  Other wise we return null.
        /// </summary>
        /// <param name="exception">Exception to be processed</param>
        /// <param name="service">Data service instance</param>
        /// <returns>An action that can serialize the exception into a stream.</returns>
        private static Action <Stream> ProcessBenignException(Exception exception, IDataService service)
        {
            DataServiceException dataServiceException = exception as DataServiceException;

            if (dataServiceException != null)
            {
                if (dataServiceException.StatusCode == (int)System.Net.HttpStatusCode.NotModified)
                {
                    DataServiceHostWrapper host = service.OperationContext.Host;
                    Debug.Assert(host != null, "host != null");
                    host.ResponseStatusCode = (int)System.Net.HttpStatusCode.NotModified;

                    // For 304, we MUST return an empty message-body.
                    return(WebUtil.GetEmptyStreamWriter());
                }
            }

            return(null);
        }