THRIFT-3361 Improve C# library Client: C# Patch: Jens Geyer <[email protected]>
Replaced a bunch of C# exceptions with TTransportException. Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/96409d9d Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/96409d9d Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/96409d9d Branch: refs/heads/master Commit: 96409d9dfecd8213726ee83ff1ac40695f8eeeec Parents: 178b813 Author: Jens Geyer <[email protected]> Authored: Wed Sep 30 23:30:35 2015 +0200 Committer: Jens Geyer <[email protected]> Committed: Wed Sep 30 23:30:35 2015 +0200 ---------------------------------------------------------------------- lib/csharp/src/Transport/TBufferedTransport.cs | 6 +++--- lib/csharp/src/Transport/TFramedTransport.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/96409d9d/lib/csharp/src/Transport/TBufferedTransport.cs ---------------------------------------------------------------------- diff --git a/lib/csharp/src/Transport/TBufferedTransport.cs b/lib/csharp/src/Transport/TBufferedTransport.cs index e88800f..caedd87 100644 --- a/lib/csharp/src/Transport/TBufferedTransport.cs +++ b/lib/csharp/src/Transport/TBufferedTransport.cs @@ -75,7 +75,7 @@ namespace Thrift.Transport CheckNotDisposed(); ValidateBufferArgs(buf, off, len); if (!IsOpen) - throw new InvalidOperationException("Transport is not open."); + throw new TTransportException(TTransportException.ExceptionType.NotOpen); if (inputBuffer.Capacity < bufSize) inputBuffer.Capacity = bufSize; int got = inputBuffer.Read(buf, off, len); @@ -96,7 +96,7 @@ namespace Thrift.Transport CheckNotDisposed(); ValidateBufferArgs(buf, off, len); if (!IsOpen) - throw new InvalidOperationException("Transport is not open."); + throw new TTransportException(TTransportException.ExceptionType.NotOpen); // Relative offset from "off" argument int offset = 0; if (outputBuffer.Length > 0) @@ -129,7 +129,7 @@ namespace Thrift.Transport { CheckNotDisposed(); if (!IsOpen) - throw new InvalidOperationException("Transport is not open."); + throw new TTransportException(TTransportException.ExceptionType.NotOpen); if (outputBuffer.Length > 0) { transport.Write(outputBuffer.GetBuffer(), 0, (int)outputBuffer.Length); http://git-wip-us.apache.org/repos/asf/thrift/blob/96409d9d/lib/csharp/src/Transport/TFramedTransport.cs ---------------------------------------------------------------------- diff --git a/lib/csharp/src/Transport/TFramedTransport.cs b/lib/csharp/src/Transport/TFramedTransport.cs index 9c6a794..a369e8e 100644 --- a/lib/csharp/src/Transport/TFramedTransport.cs +++ b/lib/csharp/src/Transport/TFramedTransport.cs @@ -73,7 +73,7 @@ namespace Thrift.Transport CheckNotDisposed(); ValidateBufferArgs(buf, off, len); if (!IsOpen) - throw new InvalidOperationException("Transport is not open."); + throw new TTransportException(TTransportException.ExceptionType.NotOpen); int got = readBuffer.Read(buf, off, len); if (got > 0) { @@ -102,7 +102,7 @@ namespace Thrift.Transport CheckNotDisposed(); ValidateBufferArgs(buf, off, len); if (!IsOpen) - throw new InvalidOperationException("Transport is not open."); + throw new TTransportException(TTransportException.ExceptionType.NotOpen); if (writeBuffer.Length + (long)len > (long)int.MaxValue) Flush(); writeBuffer.Write(buf, off, len); @@ -112,7 +112,7 @@ namespace Thrift.Transport { CheckNotDisposed(); if (!IsOpen) - throw new InvalidOperationException("Transport is not open."); + throw new TTransportException(TTransportException.ExceptionType.NotOpen); byte[] buf = writeBuffer.GetBuffer(); int len = (int)writeBuffer.Length; int data_len = len - HeaderSize;
