@@ -189,7 +189,8 @@ do_resolve_many([Msg1, Msg2 | MsgList], Opts) ->
189189 resolved_message_of_many ,
190190 {msg3 , Msg3 },
191191 {opts , Opts }
192- }
192+ },
193+ Opts
193194 ),
194195 do_resolve_many ([Msg3 | MsgList ], Opts );
195196 Res ->
@@ -272,7 +273,7 @@ resolve_stage(2, Msg1, Msg2, Opts) ->
272273 % only return a result if it is already in the cache).
273274 case hb_cache_control :maybe_lookup (Msg1 , Msg2 , Opts ) of
274275 {ok , Msg3 } ->
275- ? event (ao_core , {stage , 2 , cache_hit , {msg3 , Msg3 }, {opts , Opts }}),
276+ ? event (ao_core , {stage , 2 , cache_hit , {msg3 , Msg3 }, {opts , Opts }}, Opts ),
276277 {ok , Msg3 };
277278 {continue , NewMsg1 , NewMsg2 } ->
278279 resolve_stage (3 , NewMsg1 , NewMsg2 , Opts );
@@ -357,7 +358,7 @@ resolve_stage(4, Msg1, Msg2, Opts) ->
357358 end
358359 end .
359360resolve_stage (5 , Msg1 , Msg2 , ExecName , Opts ) ->
360- ? event (ao_core , {stage , 5 , device_lookup }),
361+ ? event (ao_core , {stage , 5 , device_lookup }, Opts ),
361362 % Device lookup: Find the Erlang function that should be utilized to
362363 % execute Msg2 on Msg1.
363364 {ResolvedFunc , NewOpts } =
@@ -409,7 +410,8 @@ resolve_stage(5, Msg1, Msg2, ExecName, Opts) ->
409410 {exec_exception , Exception },
410411 {exec_stacktrace , Stacktrace },
411412 {opts , Opts }
412- }
413+ },
414+ Opts
413415 ),
414416 % If the device cannot be loaded, we alert the caller.
415417 error_execution (
@@ -426,7 +428,7 @@ resolve_stage(6, Func, Msg1, Msg2, ExecName, Opts) ->
426428 % Execution.
427429 % First, determine the arguments to pass to the function.
428430 % While calculating the arguments we unset the add_key option.
429- UserOpts1 = maps :without (? TEMP_OPTS , Opts ),
431+ UserOpts1 = maps :remove ( trace , maps : without (? TEMP_OPTS , Opts ) ),
430432 % Unless the user has explicitly requested recursive spawning, we
431433 % unset the spawn_worker option so that we do not spawn a new worker
432434 % for every resulting execution.
@@ -479,7 +481,8 @@ resolve_stage(6, Func, Msg1, Msg2, ExecName, Opts) ->
479481 {exec_exception , ExecException },
480482 {exec_stacktrace , erlang :process_info (self (), backtrace )},
481483 {opts , Opts }
482- }
484+ },
485+ Opts
483486 ),
484487 % If the function call fails, we raise an error in the manner
485488 % indicated by caller's `#Opts'.
@@ -691,7 +694,7 @@ error_invalid_intermediate_status(Msg1, Msg2, Msg3, RemainingPath, Opts) ->
691694error_execution (ExecGroup , Msg2 , Whence , {Class , Exception , Stacktrace }, Opts ) ->
692695 Error = {error , Whence , {Class , Exception , Stacktrace }},
693696 hb_persistent :unregister_notify (ExecGroup , Msg2 , Error , Opts ),
694- ? event (ao_core , {handle_error , Error , {opts , Opts }}),
697+ ? event (ao_core , {handle_error , Error , {opts , Opts }}, Opts ),
695698 case hb_opts :get (error_strategy , throw , Opts ) of
696699 throw -> erlang :raise (Class , Exception , Stacktrace );
697700 _ -> Error
@@ -954,7 +957,8 @@ message_to_fun(Msg, Key, Opts) ->
954957 {key , Key },
955958 {is_exported , Exported },
956959 {opts , Opts }
957- }
960+ },
961+ Opts
958962 ),
959963 % Does the device have an explicit handler function?
960964 case {maps :find (handler , Info ), Exported } of
0 commit comments