Skip to content

Commit

Permalink
fix get_stacktrace deprecations
Browse files Browse the repository at this point in the history
===> Compiling _build/default/lib/webmachine/src/webmachine_resource.erl failed
_build/default/lib/webmachine/src/webmachine_resource.erl:205: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace

Signed-off-by: Lincoln Baker <[email protected]>
  • Loading branch information
lbakerchef committed Aug 5, 2020
1 parent 42dd2f9 commit 6f1819d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/webmachine_decision_core.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ handle_request(Resource, ReqState) ->
try
d(v3b13)
catch
error:_ ->
error_response(erlang:get_stacktrace())
error:_:Stacktrace ->
error_response(Stacktrace)
end.

wrcall(X) ->
Expand Down
4 changes: 2 additions & 2 deletions src/webmachine_resource.erl
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ resource_call(F, ReqData,
end,
Result = try
apply(R_Mod, F, [ReqData, R_ModState])
catch C:R ->
Reason = {C, R, trim_trace(erlang:get_stacktrace())},
catch C:R:Stacktrace ->
Reason = {C, R, trim_trace(Stacktrace)},
{{error, Reason}, ReqData, R_ModState}
end,
case R_Trace of
Expand Down
4 changes: 2 additions & 2 deletions test/decision_core_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ setup() ->
meck:new(webmachine_resource, MeckOpts),
Ctx
catch
T:E ->
io:format(user, "~n~p : ~p : ~p", [T, E, erlang:get_stacktrace()]),
T:E:Stacktrace ->
io:format(user, "~n~p : ~p : ~p", [T, E, Stacktrace]),
error(setup_failed)
end.

Expand Down

0 comments on commit 6f1819d

Please sign in to comment.