-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Handle uncaught errors thrown as strings #7637
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisbreiding So, I get that this does actually fix an issue with string errors.
But, I don't really see this addressing the true intent of the original issue, which was a way to listen to errors in the uncaught:exception
based on the original err.message
. We always mutate it, so they have to do some weird regex to recognize it and pull that out.
We did change the err.message from 4.5.0 -> 4.6.0, so it could have effected some people's regexing of it...but...I wouldn't say this is a regression per se.
This should probably be a new PR to address, but people want a way to easily ignore certain application errors - that's the request. And they're thinking just pulling out the original err.message
would help.
4.5.0
4.8.0
User facing changelog
Additional details
If a user application threw an error as a string (
throw 'some error'
as opposed tothrow new Error('some error')
, an internal errorCannot read property 'split' of undefined
would be displayed and theuncaught:exception
event would be called with the error as a string instead of as an object with typical error properties.How has the user experience changed?
If there is a string exception in an application, the test will now fail with the correct error. If the
uncaught:exception
event is being used, it will be called with an error object now, as it should.PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?