Don't repeat callbackOnFailure twice.

Move callbackOnFailure to the outer block so that two error cases can share the same
callbackOnFailure. Also move callbackOnSucess for consistency.