예제 #1
0
        /// <summary>Create a instance of <see cref="Message" /> from an exception. This is sent as the response.</summary>
        /// <param name="exception">Exception to process</param>
        /// <returns>An instance of <see cref="Message" /> class.</returns>
        private Message CreateMessageFromUnhandledException(Exception exception)
        {
            string exceptionMessage = WebUtil.GetExceptionMessage(exception);

            SyncServiceTracer.TraceError(exceptionMessage);

            return(_syncConfiguration.UseVerboseErrors
                                   ? CreateExceptionMessage(HttpStatusCode.InternalServerError, exceptionMessage)
                                   : CreateExceptionMessage(HttpStatusCode.InternalServerError, Strings.InternalServerError));
        }
 /// <summary>
 /// Delegate passed into the custom body writer to form the outgoing response.
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="syncWriter"></param>
 private static void WriteResponse(XmlDictionaryWriter writer, SyncWriter syncWriter)
 {
     try
     {
         syncWriter.WriteFeed(writer);
     }
     catch (Exception exception)
     {
         // An exception at this point seems to be unrecoverable but ideally we should not hit exceptions since we are only
         // writing to the XmlDictionaryWriter.
         SyncServiceTracer.TraceError("Exception in WriteResponse method. Details: {0}", WebUtil.GetExceptionMessage(exception));
     }
 }