class LittleGhost::Runtime::Hook
Hooks let applications prepare runs, transform interruptions, and map errors to caller-safe messages.
Hooks are instantiated once per Runtime in configuration order. Override only the methods needed and return the supplied value when leaving it unchanged.
class TenantHook < LittleGhost::Runtime::Hook def prepare_run(run) run.register(TenantConnection.new(run.invocation.actor_id)) run end end
Public Instance Methods
Source
# File lib/little_ghost/runtime/hook.rb, line 28 def error_message(_error, _run) = nil
Returns a caller-safe error message, or nil to defer to later hooks and the runtime default. Avoid exposing secrets or internal exception text.
# File lib/little_ghost/runtime/hook.rb, line 24 def prepare_interruption(_run, payload) = payload
Transforms an interruption payload before it reaches the agent.
Source
# File lib/little_ghost/runtime/hook.rb, line 21 def prepare_run(run) = run
Prepares a newly built Run. Resources registered on the run share its lifecycle and close in reverse order.