Move uncaught exception handler.
Fix unit test.
Merge pull request #186 from greboid/moveerrorhandler

Move uncaught exception handler.