As reported in T372068#11075998 we sometimes gets errors like:
Error: invalidjson: No valid JSON response at /src/node_modules/mwbot/src/index.js:254:31 at tryCatcher (/src/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/src/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/src/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/src/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/src/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/src/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/src/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/src/node_modules/bluebird/js/release/async.js:102:5) at Async.drainQueues [as _onImmediate] (/src/node_modules/bluebird/js/release/async.js:15:14) at process.processImmediate (node:internal/timers:483:21)
We get that it's invalid JSON but can't see/understand what's going on. We should make PR for mwbot where it instead of hardcode the error reason also includes information from the page. For example status code (if it's not a 200), and some part of the response. That way we will be able to see/understand what's going on in the logs.
Expected Behavior: When we get an JSON error from mwbot in the logs we should be able to understand what's wrong
Actual Behavior: The only error we get is No valid JSON response
Steps to reproduce: Check T372068 or you could probably just point mwbot to a page that returns HTML/error page and you will get that error
Notes:
- MWBot is abandoned, so our PR won't be reviewed and merged