I was seeing a lot of xml construct PHP errors on the watchdog, and they were because of an attempt to parse XML from incorrect data.

Attached is a patch that not only check for codes <0 but also >= 500, and if detected, properly logging them into both status and watchdog and aborting the process instead of letting the parser continue.

Comments

hanoii’s picture

Status: Active » Needs review
StatusFileSize
new1.2 KB
hanoii’s picture

Title: better error handling and logging for 5xx errors » better error handling and logging for 5xx errors (recent frequent 502 bad gateway errors)
StatusFileSize
new2.06 KB

Attached is a better patch.

It also handled error code 0 as an error (I think it's due to timeout) and also handle the same <=0 and >= 500 errors on the batch processing to prevent cron from halting.

This again is specially useful for the lately 502 errors I (and others on google search) have been seeing.