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.
ERROR: FIXME: This is a known failure of filelog.size for data starting with \1\nOK.