maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
227 stars 24 forks source link

add option to ignore errors in batches #106

Closed rwst closed 4 years ago

rwst commented 4 years ago

I have a remove-claim batch that occasionally gets an error or hangs server-side. The errors stop the whole batch but batch processing could be continued: processing line 35: Q22234715$56C0A8C2-4B31-4F35-BC1D-7C5537968544

{ failed-save: failed-save: The save has failed.
    at requestError (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/request/insistent_req.js:58:15)
    at res.json.then.resBody (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/request/insistent_req.js:51:38)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  name: 'failed-save',
  statusCode: undefined,
  statusMessage: undefined,
  headers: 
   Headers {
     [Symbol(map)]: 
      { date: [ 'Thu, 30 Apr 2020 17:36:56 GMT' ],
        server: [ 'mw1374.eqiad.wmnet' ],
        'x-content-type-options': [ 'nosniff' ],
        'mediawiki-api-error': [ 'failed-save, editconflict' ],
        'x-frame-options': [ 'DENY' ],
        'content-disposition': [ 'inline; filename=api-result.json' ],
        'cache-control': [ 'private, must-revalidate, max-age=0' ],
        vary: [ 'Accept-Encoding' ],
        'set-cookie': 
         [ 'cpPosIndex=1%401588268216%23aaa480509c3b8f46ea6888cf971b6898; expires=Thu, 30-Apr-2020 17:37:06 GMT; Max-Age=10; path=/; secure; HttpOnly',
           'UseDC=master; expires=Thu, 30-Apr-2020 17:37:06 GMT; Max-Age=10; path=/; secure; HttpOnly',
           'UseCDNCache=false; expires=Thu, 30-Apr-2020 17:37:06 GMT; Max-Age=10; path=/; secure; HttpOnly',
           'WMF-Last-Access=30-Apr-2020;Path=/;HttpOnly;secure;Expires=Mon, 01 Jun 2020 12:00:00 GMT',
           'WMF-Last-Access-Global=30-Apr-2020;Path=/;Domain=.wikidata.org;HttpOnly;secure;Expires=Mon, 01 Jun 2020 12:00:00 GMT',
           'GeoIP=DE:BE:Berlin:52.51:13.56:v4; Path=/; secure; Domain=.wikidata.org' ],
        'content-type': [ 'application/json; charset=utf-8' ],
        'content-encoding': [ 'gzip' ],
        age: [ '0' ],
        'x-cache': [ 'cp3064 miss, cp3058 pass' ],
        'x-cache-status': [ 'pass' ],
        'server-timing': [ 'cache;desc="pass"' ],
        'strict-transport-security': [ 'max-age=106384710; includeSubDomains; preload' ],
        'x-client-ip': [ '91.65.65.171' ],
        'accept-ranges': [ 'bytes' ],
        'content-length': [ '300' ],
        connection: [ 'close' ] } },
  body: 
   { error: 
      { code: 'failed-save',
        info: 'The save has failed.',
        messages: 
         [ { name: 'wikibase-api-failed-save',
             parameters: [],
             html: { '*': 'The save has failed.' } },
           { name: 'edit-conflict',
             parameters: [],
             html: { '*': 'Edit conflict.' } } ],
        '*': 'See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.' },
     servedby: 'mw1374' },
  url: 'https://www.wikidata.org/w/api.php?action=wbremoveclaims&format=json' }
maxlath commented 4 years ago

I added a --no-exit-on-error option in v11.2.0

rwst commented 4 years ago

Thanks!