mongopatch
mongopatch copied to clipboard
Catch unexpected errors during patch
When something is going wrong during patch, and error is not returned by callback, than i can't see before
and after
documents in error message, or at least before
document. I think there should be try catch inside patch
with fallback to general callback(catchedErr)
Just real example: One patched failed on 46% of progress, and it looks like document-specific problem, but i can't see that problematic document
ubuntu@ip-10-73-144-232 production-deployment ~ $ mongopatch debitoor-patch/patches/14w13/SB-7884-set-unpaidAmountCents-for-expenses --db "$MONGOPATCH_STAGING2_DB" --log-db "$MONGOPATCH_LOG" --dry-run --parallel 25 Progress: [=======================> ] 40938/87229 46.9% Patch: patch_20140319.091131.858_economic-staging-eu-2.expenses
Summary: Time 00h 07m 45s
ETA 00h 09m 01s (speed 87)
Modified 40938 (rest 0)
Skipped 0
Diff: added updated removed
unpaidAmountCents +40937 1 0
unpaidAmount 0 0 -1876
Cannot call method 'minus' of undefined
TypeError: Cannot call method 'minus' of undefined
at substractAmount (/home/ubuntu/debitoor-patch/patches/14w13/SB-7884-set-unpaidAmountCents-for-expenses/index.js:87:25)
at getUnpaidAmount (/home/ubuntu/debitoor-patch/patches/14w13/SB-7884-set-unpaidAmountCents-for-expenses/index.js:56:9)
at /home/ubuntu/debitoor-patch/patches/14w13/SB-7884-set-unpaidAmountCents-for-expenses/index.js:16:48
at null._ontransform (/usr/local/lib/node_modules/mongopatch/source/streams.js:222:3)
at ParallelTransform._transform (/usr/local/lib/node_modules/mongopatch/node_modules/parallel-transform/index.js:46:7)
at Transform._read (_stream_transform.js:179:10)
at Readable.read (_stream_readable.js:320:10)
at flow (_stream_readable.js:589:52)
at null.