Handle exceptions in thread workers

I discovered that exceptions occurring in background threads (as scheduled through the QThreadExecutor) weren't caught and passed on as they should. This patch rectifies that, and there's a test to prove it :)