New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-cross-origin uncaught error messages are left undefined #7590
Comments
The code line being referred to is here: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/errors.js#L42:L42 I can recreate the behavior from the code provided. This is a common workaround for people to ignore specific error messages coming from app/cross origin scripts and I believe should be continued to be supported in some way. I even advised people with this ResizeObserver error to ignore them in this way: quasarframework/quasar#2233 (comment) |
@jennifer-shehane I think the error you're seeing is different due to an omission in the code reproduction. In the html, it should be: document.getElementById("button").addEventListener("click", () => { When I fix that, I get the following error:
@juliogarciag Is that the error you see when the |
In looking into this further, I think the test code should be revised to: Cypress.on('uncaught:exception', (err, runnable) => {
if (err.message.includes("clicked")) {
return false;
}
}) The error will always be wrapped in the "originated from your application" part, so the message won't exactly equal the one thrown. It will include the message thrown though. This matches the code included in the issue description concerning the |
Oh, it seems I made a mistake on that reproduction. It needs the click to work, and it only happen when an error meets these two criteria. I don't remember right now if that was the exact error I got, just that |
The code for this is done in cypress-io/cypress#7637, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
In this PR, the way
createUncaughtException
creates an error changed, and themessage
variable was leftundefined
under these conditions: ifcrossOriginScriptRe.test(msg)
fails and theerr
variable is not defined. The error that triggered the situation was aResizeObserver loop limit exceeded
error.Because the error message ends up being
undefined
, checks like this no longer work:This is a screenshot of the debugging session in which I found this:
Desired behavior:
The final uncaught error message has the original information and can be used to catch expected errors.
Test code to reproduce
Any thrown string should work:
index.html
test.js
Versions
Cypress 4.7.0
MacOS 10.15.5
Electron 80
The text was updated successfully, but these errors were encountered: