I agree that this is not the appropriate way of handling this issue. We
1. Make the worker bubble up a disconnection notification, with an error
2. Update the UI to explain that we're offline, and disable write
3. Have the UI initiate a worker reconnection with an exponential
And we need a :disconnect and :reconnect option for the user to do this
Thanks for your patch.
However, this is no the right approach in my opinion.
The error you are catching is specific to the imap worker and needs to be addressed
in the worker, located under /worker/imap.
Also I think we should reconnect and then retry to handle the message (the task)
we just tried to process, up to a certain retry limit of course.