Catch exception when something very bad happens like trying to log a document element.

Logging responseText should be enough as a first step to discover what's wrong.