是否有可能捕获一个可能的错误,在handle_events
该错误中创建此异常?
[error] GenServer #PID<0.1278.0> terminating
我尝试在消费者中收听回调def terminate(reason, state) do
,但没有被调用。
我想知道 genstage 是否有某种我可以使用的错误处理,而不必包含handle_events
在 try/catch 中
def handle_events(events, _from, _state) do
# just post the events to an external service
# after some trivial transformations
# events might be bad encoded or some other error
# might happen and genserver will terminate
post_events(events)
{:noreply, [], state}
end