dispatch: split global error handling out so it can be reused
We may want a similar error handling at worker.py. This patch extracts the
error handling logic to "callcatch" so it can be reused.
................
----------------------------------------------------------------------
Ran 16 tests in 0.000s
OK