This page calls TeXZilla.toMathML every 500ms to show a preview. It passes the parameter aThrowExceptionOnError = true in order to detect when the parsing fails and in that case shows the original TeX source.
aThrowExceptionOnError = true