catch [error] GenServer #PID<0.1278.0> terminating

时间:2018-08-22 13:44:46

标签: elixir genstage

Is it possible to catch a possible error within handle_events which creates this exception?

[error] GenServer #PID<0.1278.0> terminating

I tried listening in the consumer to the callback def terminate(reason, state) do but is not being called.

I am wondering if genstage has some kind of error handling I can use without having to wrap handle_events in a 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

0 个答案:

没有答案