Skip to content

Commit

Permalink
Merge pull request #432 from sezaru/master
Browse files Browse the repository at this point in the history
Replace deprecated System.stacktrace() with __STACKTRACE__
  • Loading branch information
teamon authored Mar 24, 2021
2 parents daaccbc + a0734f8 commit b7d3326
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/tesla/middleware/telemetry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if Code.ensure_loaded?(:telemetry) do
Tesla.run(env, next)
catch
kind, reason ->
stacktrace = System.stacktrace()
stacktrace = __STACKTRACE__
duration = System.monotonic_time() - start_time

emit_exception(
Expand Down
2 changes: 1 addition & 1 deletion lib/tesla/middleware/timeout.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ defmodule Tesla.Middleware.Timeout do
{:ok, func.()}
rescue
e in _ ->
{:exception, e, System.stacktrace()}
{:exception, e, __STACKTRACE__}
catch
type, value ->
{type, value}
Expand Down
2 changes: 1 addition & 1 deletion lib/tesla/mock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,6 @@ defmodule Tesla.Mock do
fun.(env)
rescue
ex in FunctionClauseError ->
raise Tesla.Mock.Error, env: env, ex: ex, stacktrace: System.stacktrace()
raise Tesla.Mock.Error, env: env, ex: ex, stacktrace: __STACKTRACE__
end
end
4 changes: 2 additions & 2 deletions test/tesla/middleware/timeout_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ defmodule Tesla.Middleware.TimeoutTest do
Client.get("/raise")
rescue
_ in RuntimeError ->
[{last_module, _, _, file_info} | _] = System.stacktrace()
[{last_module, _, _, file_info} | _] = __STACKTRACE__

assert Tesla.Middleware.TimeoutTest.Client == last_module
assert [file: 'lib/tesla/builder.ex', line: 23] == file_info
Expand All @@ -107,7 +107,7 @@ defmodule Tesla.Middleware.TimeoutTest do
Client.get("/raise")
rescue
_ in RuntimeError ->
[_, {timeout_module, _, _, module_file_info} | _] = System.stacktrace()
[_, {timeout_module, _, _, module_file_info} | _] = __STACKTRACE__

assert Tesla.Middleware.Timeout == timeout_module
assert module_file_info == [file: 'lib/tesla/middleware/timeout.ex', line: 45]
Expand Down

0 comments on commit b7d3326

Please sign in to comment.