git ssb

0+

cel / pull-git-remote-helper



Commit 9c5fc252c08c46239564a18250cc3d09354a620b

Improve error handling when there is no object sink

Charles Lehner committed on 2/17/2016, 3:04:03 AM
Parent: b390ecc4bf4d610b201252d8a8a0cd1ad8cd2748

Files changed

index.jschanged
lib/pack.jschanged
index.jsView
@@ -212,9 +212,10 @@
212212 }
213213
214214 module.exports = function (opts) {
215215 var ended
216- var objectSink = opts.objectSink || pull.error('Missing object sink')
216+ var objectSink = opts.objectSink ||
217+ function () { throw new Error('Missing object sink') }
217218 var hasObject = opts.hasObject || function (hash, cb) { cb(false) }
218219 var getObjects = opts.getObjects || function (id, cb) {
219220 cb(null, 0, pull.empty())
220221 }
lib/pack.jsView
@@ -204,9 +204,9 @@
204204 }
205205
206206 function readObject(abort, cb) {
207207 if (ended) cb(ended)
208- else if (abort) read(abort)
208+ else if (abort) read(abort, function (err) { cb(ended = err || abort) })
209209 else if (numObjects < 0) readHeader(cb)
210210 else if (numObjects > 0) getObject(cb)
211211 else if (expectChecksum) readTrailer(cb)
212212 }

Built with git-ssb-web