[thrift] make Erlang server noisy when handler has error
Summary: generate an error message at the server ... before only the client got the error
Reviewed By: iproctor
Test Plan: tutorial, channel server
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665187 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/lib/thrift/src/transport/tErlAcceptor.erl b/lib/erl/lib/thrift/src/transport/tErlAcceptor.erl
index 3407c82..8093e00 100644
--- a/lib/erl/lib/thrift/src/transport/tErlAcceptor.erl
+++ b/lib/erl/lib/thrift/src/transport/tErlAcceptor.erl
@@ -8,6 +8,7 @@
-include("oop.hrl").
-include("thrift.hrl").
+-include("tApplicationException.hrl").
-include("transport/tTransportException.hrl").
-include("transport/tServerSocket.hrl").
-include("transport/tErlAcceptor.hrl").
@@ -100,10 +101,14 @@
end.
receive_loop(This, Processor, Iprot, Oprot) ->
- try
- Value = ?R2(Processor, process, Iprot, Oprot),
- ?INFO(req_processed, {Value}),
- receive_loop(This, Processor, Iprot, Oprot)
+ try ?R2(Processor, process, Iprot, Oprot) of
+ {error, TAE} when is_record(TAE, tApplicationException),
+ TAE#tApplicationException.type == ?tApplicationException_HANDLER_ERROR ->
+ ?ERROR("handler returned an error: ~p", [oop:get(TAE, message)]),
+ receive_loop(This, Processor, Iprot, Oprot);
+ Value ->
+ ?INFO(req_processed, {Value}),
+ receive_loop(This, Processor, Iprot, Oprot)
catch
%% the following clause must be last because we might reexit
%% cpiro: breaks if it's a subclass of tTransportException
diff --git a/lib/erl/lib/thrift/src/transport/tSocket.erl b/lib/erl/lib/thrift/src/transport/tSocket.erl
index dd1ff9b..491d86b 100644
--- a/lib/erl/lib/thrift/src/transport/tSocket.erl
+++ b/lib/erl/lib/thrift/src/transport/tSocket.erl
@@ -15,7 +15,7 @@
-behavior(oop).
--export([attr/4, super/0, inspect/1, catches/2]).
+-export([attr/4, super/0, inspect/1]).
-export([new/0, new/1, new/2,
effectful_setHandle/2, effectful_open/1,