Catch exceptions in an XSS script and return the error.