From df62fb92dca84498c61609e01a95171f96b1c13d Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Sat, 4 Feb 2017 18:52:13 +0300 Subject: [PATCH] MSPF-191: Bump to rbkmoney/woody_erlang@17bd521, fix exception handling (#68) * MSPF-191: Bump to rbkmoney/woody_erlang@17bd521 and fix exception handling * MSPF-191: Switch off debug output in tests --- apps/hellgate/src/hg_party.erl | 19 +++++++------------ apps/hellgate/test/hg_ct_helper.erl | 2 +- rebar.lock | 4 ++-- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/apps/hellgate/src/hg_party.erl b/apps/hellgate/src/hg_party.erl index 8db09a0..cb33cd2 100644 --- a/apps/hellgate/src/hg_party.erl +++ b/apps/hellgate/src/hg_party.erl @@ -366,15 +366,10 @@ process_call(Call, History) -> try handle_call(Call, {St, []}) catch - {exception, Exception} -> + throw:Exception -> respond_w_exception(Exception) end. --spec raise(term()) -> no_return(). - -raise(What) -> - throw({exception, What}). - handle_call({block, Reason}, StEvents0) -> ok = assert_unblocked(StEvents0), {ClaimID, StEvents1} = create_claim([{blocking, ?blocked(Reason)}], StEvents0), @@ -609,7 +604,7 @@ get_payments_service_terms(ShopID, Party, Timestamp) -> assert_contract_active(#domain_Contract{status = {active, _}}) -> ok; assert_contract_active(#domain_Contract{status = Status}) -> - raise(#payproc_InvalidContractStatus{status = Status}). + throw(#payproc_InvalidContractStatus{status = Status}). compute_terms(#domain_Contract{terms = TermsRef, adjustments = Adjustments}, Timestamp) -> ActiveAdjustments = lists:filter(fun(A) -> is_adjustment_active(A, Timestamp) end, Adjustments), @@ -817,7 +812,7 @@ assert_claim_pending(ID, {St, _}) -> #payproc_Claim{status = ?pending()} -> ok; #payproc_Claim{status = Status} -> - raise(#payproc_InvalidClaimStatus{status = Status}) + throw(#payproc_InvalidClaimStatus{status = Status}) end. construct_claim(Changeset, St) -> @@ -866,12 +861,12 @@ assert_suspended({St, _}) -> assert_blocking(#domain_Party{blocking = {Status, _}}, Status) -> ok; assert_blocking(#domain_Party{blocking = Blocking}, _) -> - raise(#payproc_InvalidPartyStatus{status = {blocking, Blocking}}). + throw(#payproc_InvalidPartyStatus{status = {blocking, Blocking}}). assert_suspension(#domain_Party{suspension = {Status, _}}, Status) -> ok; assert_suspension(#domain_Party{suspension = Suspension}, _) -> - raise(#payproc_InvalidPartyStatus{status = {suspension, Suspension}}). + throw(#payproc_InvalidPartyStatus{status = {suspension, Suspension}}). assert_shop_modification_allowed(ID, {St, Events}) -> % We allow updates to pending shop @@ -897,12 +892,12 @@ assert_shop_suspended(ID, {St, _}) -> assert_shop_blocking(#domain_Shop{blocking = {Status, _}}, Status) -> ok; assert_shop_blocking(#domain_Shop{blocking = Blocking}, _) -> - raise(#payproc_InvalidShopStatus{status = {blocking, Blocking}}). + throw(#payproc_InvalidShopStatus{status = {blocking, Blocking}}). assert_shop_suspension(#domain_Shop{suspension = {Status, _}}, Status) -> ok; assert_shop_suspension(#domain_Shop{suspension = Suspension}, _) -> - raise(#payproc_InvalidShopStatus{status = {suspension, Suspension}}). + throw(#payproc_InvalidShopStatus{status = {suspension, Suspension}}). %% diff --git a/apps/hellgate/test/hg_ct_helper.erl b/apps/hellgate/test/hg_ct_helper.erl index f485095..495f359 100644 --- a/apps/hellgate/test/hg_ct_helper.erl +++ b/apps/hellgate/test/hg_ct_helper.erl @@ -49,7 +49,7 @@ start_app(lager = AppName) -> {error_logger_hwm, 600}, {suppress_application_start_stop, true}, {handlers, [ - {lager_common_test_backend, debug} + {lager_common_test_backend, info} ]} ]), #{}}; diff --git a/rebar.lock b/rebar.lock index 555b3df..64ade0f 100644 --- a/rebar.lock +++ b/rebar.lock @@ -29,7 +29,7 @@ 0}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.0.2">>},2}, - {<<"ranch">>,{pkg,<<"ranch">>,<<"1.2.1">>},2}, + {<<"ranch">>,{pkg,<<"ranch">>,<<"1.3.1">>},2}, {<<"rfc3339">>,{pkg,<<"rfc3339">>,<<"0.9.0">>},0}, {<<"snowflake">>, {git,"https://github.com/rbkmoney/snowflake.git", @@ -42,5 +42,5 @@ 1}, {<<"woody">>, {git,"git@github.com:rbkmoney/woody_erlang.git", - {ref,"249fa01d1385babf7da96aeb82d9ed006d55465d"}}, + {ref,"17bd5218432f3d958d2b8425267f13a3774b7d26"}}, 0}].