try to catch errors in document.