예제 #1
0
        protected override void WriteErrorDetails(CommunicationException exception)
        {
            ServiceManagementError serviceManagementError = null;

            GatewayManagementHelper.TryGetExceptionDetails(exception, out serviceManagementError);
            if (serviceManagementError != null)
            {
                object[] code = new object[2];
                code[0] = serviceManagementError.Code;
                code[1] = serviceManagementError.Message;
                string str = string.Format(CultureInfo.InvariantCulture, "HTTP Status Code: {0} - HTTP Error Message: {1}", code);
                base.WriteError(new ErrorRecord(new CommunicationException(str), string.Empty, ErrorCategory.CloseError, null));
                return;
            }
            else
            {
                base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
                return;
            }
        }
예제 #2
0
        protected override void WriteErrorDetails(CommunicationException exception)
        {
            ServiceManagementError error;

            GatewayManagementHelper.TryGetExceptionDetails(exception, out error);

            if (error == null)
            {
                WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
            }
            else
            {
                string errorDetails = string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.HttpStatusCodeAndErrorMessage,
                    error.Code,
                    error.Message);

                WriteError(new ErrorRecord(new CommunicationException(errorDetails), string.Empty, ErrorCategory.CloseError, null));
            }
        }