@@ -150,6 +150,14 @@ func (verifier *Verifier) compareDocsFromChannels(
150150 byteCount += types .ByteCount (len (doc ))
151151
152152 err = handleNewDoc (doc , true )
153+
154+ if err != nil {
155+ err = errors .Wrapf (
156+ err ,
157+ "comparer thread failed to handle source doc with ID %v" ,
158+ doc .Lookup ("_id" ),
159+ )
160+ }
153161 }
154162 }
155163
@@ -164,10 +172,22 @@ func (verifier *Verifier) compareDocsFromChannels(
164172 }
165173
166174 err = handleNewDoc (doc , false )
175+
176+ if err != nil {
177+ err = errors .Wrapf (
178+ err ,
179+ "comparer thread failed to handle destination doc with ID %v" ,
180+ doc .Lookup ("_id" ),
181+ )
182+ }
167183 }
168184 }
169185 }
170186
187+ if err != nil {
188+ return nil , 0 , 0 , errors .Wrap (err , "comparer thread failed" )
189+ }
190+
171191 // We got here because both srcChannel and dstChannel are closed,
172192 // which means we have processed all documents with the same mapKey
173193 // between source & destination.
@@ -225,7 +245,15 @@ func (verifier *Verifier) getFetcherChannels(
225245 )
226246
227247 if err == nil {
228- err = iterateCursorToChannel (ctx , cursor , srcChannel )
248+ err = errors .Wrap (
249+ iterateCursorToChannel (ctx , cursor , srcChannel ),
250+ "failed to read source documents" ,
251+ )
252+ } else {
253+ err = errors .Wrap (
254+ err ,
255+ "failed to find source documents" ,
256+ )
229257 }
230258
231259 return err
@@ -241,7 +269,15 @@ func (verifier *Verifier) getFetcherChannels(
241269 )
242270
243271 if err == nil {
244- err = iterateCursorToChannel (ctx , cursor , dstChannel )
272+ err = errors .Wrap (
273+ iterateCursorToChannel (ctx , cursor , dstChannel ),
274+ "failed to read destination documents" ,
275+ )
276+ } else {
277+ err = errors .Wrap (
278+ err ,
279+ "failed to find destination documents" ,
280+ )
245281 }
246282
247283 return err
0 commit comments