From 302e829154dd4231bb3ada7238b243e98fc84912 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Wed, 6 Jul 2016 17:02:08 +0300 Subject: [PATCH] HG-40: Fix interoperability with respect to scoped record names (#6) * HG-40: Fix interoperability with respect to scoped record names * HG-40: Provide build container with the newest thrift compiler --- rebar.lock | 2 +- src/woody_server_thrift_handler.erl | 13 +++++++------ wercker.yml | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/rebar.lock b/rebar.lock index 974f74f..d9abbdf 100644 --- a/rebar.lock +++ b/rebar.lock @@ -17,5 +17,5 @@ {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.0">>},1}, {<<"thrift">>, {git,"https://github.com/rbkmoney/thrift_erlang.git", - {ref,"a517cf67e2ba7458db498cad3ca0a983f834cc7e"}}, + {ref,"1978d5a1e350694bfa3d2dc3a762176bc60c6e64"}}, 0}]. diff --git a/src/woody_server_thrift_handler.erl b/src/woody_server_thrift_handler.erl index acb5768..e733e49 100644 --- a/src/woody_server_thrift_handler.erl +++ b/src/woody_server_thrift_handler.erl @@ -233,12 +233,13 @@ handle_exception(State = #state{service = Service, transport_handler = Trans}, {ReplySpec, ExceptionTuple}, SeqId) end. -get_except(Exception, {_Fid, _, {struct, exception, {Module, Type}}, _, _}, _) when - element(1, Exception) =:= Type --> - {Exception, {Module, Type}}; -get_except(_, _, TypesModule) -> - {undefined, TypesModule}. +get_except(Exception, {_Fid, _, {struct, exception, {Module, Type}}, _, _}, TypesModule) -> + case Module:record_name(Type) of + Name when Name =:= element(1, Exception) -> + {Exception, {Module, Type}}; + _ -> + {undefined, TypesModule} + end. get_except_name(Module, Type) -> {struct, exception, Fields} = Module:struct_info(Type), diff --git a/wercker.yml b/wercker.yml index 32b99cd..54a4a7c 100644 --- a/wercker.yml +++ b/wercker.yml @@ -1,5 +1,5 @@ box: - id: rbkmoney/build_erlang + id: rbkmoney/build username: $USERNAME password: $PASSWORD tag: latest