diff --git a/elvis.config b/elvis.config index 98c4501..a1152db 100644 --- a/elvis.config +++ b/elvis.config @@ -4,7 +4,6 @@ #{ dirs => ["src", "test"], filter => "*.erl", - ignore => ["_thrift.erl$"], rules => [ {elvis_style, line_length, #{limit => 120, skip_comments => false}}, {elvis_style, no_tabs}, @@ -14,7 +13,7 @@ {elvis_style, nesting_level, #{level => 3}}, {elvis_style, god_modules, #{limit => 25, ignore => [woody_tests_SUITE]}}, {elvis_style, no_if_expression}, - {elvis_style, invalid_dynamic_call, #{}}, + {elvis_style, invalid_dynamic_call, #{ignore => [woody_client_thrift]}}, {elvis_style, used_ignored_variable}, {elvis_style, no_behavior_info}, {elvis_style, module_naming_convention, #{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$"}}, diff --git a/src/woody_client_thrift.erl b/src/woody_client_thrift.erl index 2ca8514..9b49818 100644 --- a/src/woody_client_thrift.erl +++ b/src/woody_client_thrift.erl @@ -73,10 +73,8 @@ get_transport_opts(Opts) -> do_call(Client, Function, Args, Context) -> {ClientNext, Result} = try thrift_client:call(Client, Function, Args) catch - %% In case a server violates the requirements and sends - %% #TAppiacationException{} with http status code 200. throw:{Client1, {exception, #'TApplicationException'{}}} -> - {Client1, {error, {external, result_unexpected, <<"thrift application exception unknown">>}}}; + {Client1, {error, {system, get_server_violation_error()}}}; throw:{Client1, {exception, ThriftExcept}} -> {Client1, {error, {business, ThriftExcept}}} end, @@ -84,6 +82,12 @@ do_call(Client, Function, Args, Context) -> log_result(Result, Context), map_result(Result). +get_server_violation_error() -> + {external, result_unexpected, << + "server violated thrift protocol: " + "sent TApplicationException (unknown exception) with http code 200" + >>}. + log_result({error, {business, ThriftExcept}}, Context) -> log_event(?EV_SERVICE_RESULT, Context, #{status => ok, result => ThriftExcept}); log_result({Status, Result}, Context) ->