Bug 863066: Check for error in confirm task

In confirm_user task, add a check that we got a user_data object,
but it showed an error. Log the error and raise the right exception
so our task framework will retry.

Also add a few tests for this task, which didn't appear to have any
tests previously.