Perform actions in supervisor when worker exits
<p>Is there a way to perform actions in the supervisor after a worker exits (in addition to just restarting the worker).</p>

<p>At the moment I have some code inside the worker (below) that seems to run about half the time.</p>

<pre><code>try do 
   some_work()

catch :exit, reason
   save_reason_to_db()
   exit(reason)
</code></pre>

<p>The worker has a one_for_one stragtegy, only one worker running. So every time the worker exits the supervisor will start a new one.</p>

<p>It seems like every second time this worker exits, it runs the save_reason_to_db(), and every other time it doesn't.</p>