You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2013/06/12 21:11:41 UTC
git commit: THRIFT-2015 Thrift exceptions should derive from
TException
Updated Branches:
refs/heads/master 03aaf93c5 -> b310ae781
THRIFT-2015 Thrift exceptions should derive from TException
Patch: Jens Geyer
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/b310ae78
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/b310ae78
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/b310ae78
Branch: refs/heads/master
Commit: b310ae78160bf95f6c49ed1cb13aea609878f6ee
Parents: 03aaf93
Author: Jens Geyer <je...@apache.org>
Authored: Wed Jun 12 21:09:36 2013 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Wed Jun 12 21:10:35 2013 +0200
----------------------------------------------------------------------
compiler/cpp/src/generate/t_csharp_generator.cc | 4 +-
lib/csharp/src/Protocol/TProtocolException.cs | 2 +-
lib/csharp/src/TApplicationException.cs | 2 +-
lib/csharp/src/TException.cs | 40 ++++++++++++++++++++
lib/csharp/src/Thrift.WP7.csproj | 1 +
lib/csharp/src/Thrift.csproj | 1 +
lib/csharp/src/Transport/TTransportException.cs | 2 +-
7 files changed, 47 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/b310ae78/compiler/cpp/src/generate/t_csharp_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc
index 016e3f8..37800a5 100644
--- a/compiler/cpp/src/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/generate/t_csharp_generator.cc
@@ -514,7 +514,7 @@ void t_csharp_generator::generate_csharp_struct_definition(ofstream &out, t_stru
indent(out) << "public " << (is_final ? "sealed " : "") << "partial class " << tstruct->get_name() << " : ";
if (is_exception) {
- out << "Exception, ";
+ out << "TException, ";
}
out << "TBase";
@@ -997,7 +997,7 @@ void t_csharp_generator::generate_csharp_union_definition(std::ofstream& out, t_
indent(out) << "public override void Write(TProtocol protocol) {" << endl;
indent_up();
- indent(out) << "throw new Exception(\"Cannot persist an union type which is not set.\");" << endl;
+ indent(out) << "throw new TProtocolException( TProtocolException.INVALID_DATA, \"Cannot persist an union type which is not set.\");" << endl;
indent_down();
indent(out) << "}" << endl << endl;
http://git-wip-us.apache.org/repos/asf/thrift/blob/b310ae78/lib/csharp/src/Protocol/TProtocolException.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Protocol/TProtocolException.cs b/lib/csharp/src/Protocol/TProtocolException.cs
index 4e4393f..bc002d3 100644
--- a/lib/csharp/src/Protocol/TProtocolException.cs
+++ b/lib/csharp/src/Protocol/TProtocolException.cs
@@ -25,7 +25,7 @@ using System;
namespace Thrift.Protocol
{
- public class TProtocolException : Exception
+ public class TProtocolException : TException
{
public const int UNKNOWN = 0;
public const int INVALID_DATA = 1;
http://git-wip-us.apache.org/repos/asf/thrift/blob/b310ae78/lib/csharp/src/TApplicationException.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/TApplicationException.cs b/lib/csharp/src/TApplicationException.cs
index 9aaf6f7..4a1b2d2 100644
--- a/lib/csharp/src/TApplicationException.cs
+++ b/lib/csharp/src/TApplicationException.cs
@@ -26,7 +26,7 @@ using Thrift.Protocol;
namespace Thrift
{
- public class TApplicationException : Exception
+ public class TApplicationException : TException
{
protected ExceptionType type;
http://git-wip-us.apache.org/repos/asf/thrift/blob/b310ae78/lib/csharp/src/TException.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/TException.cs b/lib/csharp/src/TException.cs
new file mode 100644
index 0000000..a99bfa8
--- /dev/null
+++ b/lib/csharp/src/TException.cs
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ * Contains some contributions under the Thrift Software License.
+ * Please see doc/old-thrift-license.txt in the Thrift distribution for
+ * details.
+ */
+
+using System;
+
+namespace Thrift
+{
+ public class TException : Exception
+ {
+ public TException()
+ {
+ }
+
+ public TException( string message)
+ : base(message)
+ {
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/b310ae78/lib/csharp/src/Thrift.WP7.csproj
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Thrift.WP7.csproj b/lib/csharp/src/Thrift.WP7.csproj
index e9dc494..2b2147e 100644
--- a/lib/csharp/src/Thrift.WP7.csproj
+++ b/lib/csharp/src/Thrift.WP7.csproj
@@ -93,6 +93,7 @@
<Compile Include="Protocol\TSet.cs" />
<Compile Include="Protocol\TStruct.cs" />
<Compile Include="Protocol\TType.cs" />
+ <Compile Include="TException.cs" />
<Compile Include="TApplicationException.cs" />
<Compile Include="TProcessor.cs" />
<Compile Include="Transport\TFramedTransport.cs" />
http://git-wip-us.apache.org/repos/asf/thrift/blob/b310ae78/lib/csharp/src/Thrift.csproj
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Thrift.csproj b/lib/csharp/src/Thrift.csproj
index cb264c8..439b960 100644
--- a/lib/csharp/src/Thrift.csproj
+++ b/lib/csharp/src/Thrift.csproj
@@ -105,6 +105,7 @@
<Compile Include="Server\TServer.cs" />
<Compile Include="Server\TSimpleServer.cs" />
<Compile Include="Server\TThreadPoolServer.cs" />
+ <Compile Include="TException.cs" />
<Compile Include="TApplicationException.cs" />
<Compile Include="TProcessor.cs" />
<Compile Include="Transport\TBufferedTransport.cs" />
http://git-wip-us.apache.org/repos/asf/thrift/blob/b310ae78/lib/csharp/src/Transport/TTransportException.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/TTransportException.cs b/lib/csharp/src/Transport/TTransportException.cs
index b96f7e8..fda0138 100644
--- a/lib/csharp/src/Transport/TTransportException.cs
+++ b/lib/csharp/src/Transport/TTransportException.cs
@@ -25,7 +25,7 @@ using System;
namespace Thrift.Transport
{
- public class TTransportException : Exception
+ public class TTransportException : TException
{
protected ExceptionType type;