Created
May 4, 2018 06:46
-
-
Save soranoba/054a8e236d398d7d5d3a3ecdeb1ab814 to your computer and use it in GitHub Desktop.
migration OTP21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-ifdef('GET_STACKTRACE_AVAILABLE'). | |
-define(CATCH_MATCH(__R), __R). | |
-define(GET_STACKTRACE(), erlang:get_stacktrace()). | |
-else. | |
-define(CATCH_MATCH(__R), __R:__StackTrace). | |
-define(GET_STACKTRACE(), __StackTrace). | |
-endif. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{erl_opts, [ | |
{platform_define, "^(R|1|20)", 'GET_STACKTRACE_AVAILABLE'} | |
]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
catch | |
- error:{badmatch, {error, {Reason, [StackItem]}}} -> | |
- erlang:raise(error, Reason, [StackItem | erlang:get_stacktrace()]) | |
+ error:?CATCH_MATCH({badmatch, {error, {Reason, [StackItem]}}}) -> | |
+ erlang:raise(error, Reason, [StackItem | ?GET_STACKTRACE()]) | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/erlang/rebar3/pull/1773/files#diff-187ab326cfb79b64e1cadf9e96407d5dR55
この対応が割とイケてる