Error handling refactor

Move transformation of errors into the default 'result' handler. This means
wrappers of 'result' will not need to worry about rejected promises, but *will*
need to check for a `result.error` property that contains the original error.