コード例 #1
0
        /// <summary>
        /// Formats service communication error.
        /// </summary>
        /// <param name="serviceName">Service name.</param>
        /// <param name="ex">Exception.</param>
        /// <returns>Communication error string.</returns>
        private string _FormatServiceCommunicationError(string serviceName,
                                                        CommunicationException ex)
        {
            switch (ex.ErrorCode)
            {
                case CommunicationError.ServiceTemporaryUnavailable:
                    {
                        var message = _app.GetString("ServiceTemporaryUnavailable", serviceName);
                        return message;
                    }

                case CommunicationError.ServiceResponseTimeout:
                    {
                        var message = _app.GetString("ServiceResponseTimeout", serviceName);
                        return message;
                    }

                default:
                    {
                        var message = _app.GetString("ServiceConnectionError", serviceName);
                        return SendRoutesHelper.FormatCommunicationError(message, ex);
                    }
            }
        }
コード例 #2
0
        internal static string FormatCommunicationError(string message,
            CommunicationException ex)
        {
            Debug.Assert(message != null);
            Debug.Assert(ex != null);

            if (ex.ErrorCode == CommunicationError.ProxyAuthenticationRequired)
            {
                message += Environment.NewLine;
                message += (string)App.Current.FindResource("ProxyAuthError");
            }

            return message;
        }