Move giant failout loop to its own function
Move giant failout loop to its own function

It's about time..

Change-Id: I27df01e3eefb2ea1ad2a7c05844eff7f63f6e9f7
Reviewed-on: http://review.couchbase.org/29782
Tested-by: Mark Nunberg <e7d42768707bf23038325b0b68d4b577e5f6064a@haskalah.org>
Reviewed-by: Sergey Avseyev <87f6d5e4fd3644c3c20800cde7fd3ad1569370b3@gmail.com>

trondn/libcouchbase,mody/libcouchbase,avsej/libcouchbase,signmotion/libcouchbase,trondn/libcouchbase,mnunberg/libcouchbase,avsej/libcouchbase,couchbase/libcouchbase,couchbase/libcouchbase,senthilkumaranb/libcouchbase,kojiromike/libcouchbase,mnunberg/libcouchbase,couchbase/libcouchbase,couchbase/libcouchbase,uvenum/libcouchbase,uvenum/libcouchbase,couchbase/libcouchbase,maxim-ky/libcouchbase,signmotion/libcouchbase,senthilkumaranb/libcouchbase,PureSwift/libcouchbase,kojiromike/libcouchbase,maxim-ky/libcouchbase,avsej/libcouchbase,couchbase/libcouchbase,senthilkumaranb/libcouchbase,trondn/libcouchbase,mnunberg/libcouchbase,PureSwift/libcouchbase,senthilkumaranb/libcouchbase,mnunberg/libcouchbase,mnunberg/libcouchbase,avsej/libcouchbase,kojiromike/libcouchbase,uvenum/libcouchbase,mody/libcouchbase,mody/libcouchbase,avsej/libcouchbase,trondn/libcouchbase,avsej/libcouchbase,couchbase/libcouchbase,PureSwift/libcouchbase,mody/libcouchbase,trondn/libcouchbase,uvenum/libcouchbase,signmotion/libcouchbase,maxim-ky/libcouchbase,signmotion/libcouchbase,uvenum/libcouchbase,kojiromike/libcouchbase,avsej/libcouchbase,PureSwift/libcouchbase,maxim-ky/libcouchbase