| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.Globalization; |
| | | 5 | | using CoreWCF.Channels; |
| | | 6 | | |
| | | 7 | | namespace CoreWCF |
| | | 8 | | { |
| | | 9 | | internal static class ProtocolExceptionHelper |
| | | 10 | | { |
| | | 11 | | internal static ProtocolException ReceiveShutdownReturnedNonNull(Message message) |
| | | 12 | | { |
| | 0 | 13 | | if (message.IsFault) |
| | | 14 | | { |
| | | 15 | | try |
| | | 16 | | { |
| | 0 | 17 | | MessageFault fault = MessageFault.CreateFault(message, 64 * 1024); |
| | 0 | 18 | | FaultReasonText reason = fault.Reason.GetMatchingTranslation(CultureInfo.CurrentCulture); |
| | 0 | 19 | | string text = SRCommon.Format(SRCommon.ReceiveShutdownReturnedFault, reason.Text); |
| | 0 | 20 | | return new ProtocolException(text); |
| | | 21 | | } |
| | 0 | 22 | | catch (QuotaExceededException) |
| | | 23 | | { |
| | 0 | 24 | | string text = SRCommon.Format(SRCommon.ReceiveShutdownReturnedLargeFault, message.Headers.Action); |
| | 0 | 25 | | return new ProtocolException(text); |
| | | 26 | | } |
| | | 27 | | } |
| | | 28 | | else |
| | | 29 | | { |
| | 0 | 30 | | string text = SRCommon.Format(SRCommon.ReceiveShutdownReturnedMessage, message.Headers.Action); |
| | 0 | 31 | | return new ProtocolException(text); |
| | | 32 | | } |
| | 0 | 33 | | } |
| | | 34 | | } |
| | | 35 | | } |