Skip to content

Commit

Permalink
Add code:ensure_loaded/1
Browse files Browse the repository at this point in the history
`verify_callable` attempts to make sure the callbacks are valid via
`erlang:function_exported/3`, but that returns false if the module is
not loaded.
  • Loading branch information
macintux committed Mar 8, 2017
1 parent bfb168e commit 627f746
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/riak_core_info_service.erl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ verify_callable([{Module, Function, Parameters}|T]) ->
%% case of registration and shutdown, it's the pid; in the case of
%% the response handler, it's the response wrapped in a tuple.
Arity = 1 + length(Parameters),

%% If `ensure_loaded' fails, `function_exported' will give us
%% `false', so no need to check for errors here
_ = code:ensure_loaded(Module),

case erlang:function_exported(Module, Function, Arity) of
true ->
verify_callable(T);
Expand Down

0 comments on commit 627f746

Please sign in to comment.