Because
- Elixir’s MOD is “let if fail”, instead of coding paranoid catching of all possible exception like in Java
- A task can be killed by other means and one still needs to handle it gracefully (perform cleanups, pubsub events etc)
So I followed @mpope’s recommendation and built a GenServer that monitors task execution and handles its death inhandle_info({:DOWN, ...and normal return inhandle_info({_, result}.... The GenServer is started in application’s supervisor tree and then when the task is started I register it using MyMonitor.monitor(task) which delegates toProcess.monitor(task.pid)- to make sure the calling process - in this case, my GenServer/Monitor - gets its handle_info called.
I wish there was an easier way out of the box but c’est la vie.


















