Skip to content
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

Merged
merged 3 commits into from
Jun 10, 2020

Conversation

chrisbreiding
Copy link
Contributor

@chrisbreiding chrisbreiding commented Jun 9, 2020

User facing changelog

  • Fixed an issue where errors thrown as strings would not display correctly.

Additional details

If a user application threw an error as a string (throw 'some error' as opposed to throw new Error('some error'), an internal error Cannot read property 'split' of undefined would be displayed and the uncaught: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

  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?
  • N/A Has a PR for user-facing changes been opened in cypress-documentation?
  • N/A Have API changes been updated in the type definitions?
  • N/A Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 9, 2020

Thanks for taking the time to open a PR!

@chrisbreiding chrisbreiding requested review from a team, brian-mann and JessicaSachs and removed request for a team June 9, 2020 14:07
@chrisbreiding chrisbreiding changed the title handle uncaught errors thrown as strings Handle uncaught errors thrown as strings Jun 9, 2020
@cypress
Copy link

cypress bot commented Jun 9, 2020



Test summary

7586 0 119 0


Run details

Project cypress
Status Passed
Commit b0fc916
Started Jun 9, 2020 2:38 PM
Ended Jun 9, 2020 2:44 PM
Duration 06:51 💡
OS Linux Debian - 10.1
Browser Multiple

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

Copy link
Contributor

@kuceb kuceb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@chrisbreiding chrisbreiding requested a review from kuceb June 9, 2020 14:57
Copy link
Member

@jennifer-shehane jennifer-shehane left a 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

Screen Shot 2020-06-10 at 12 10 36 PM

4.8.0

Screen Shot 2020-06-10 at 12 12 55 PM

@jennifer-shehane jennifer-shehane merged commit 2d2464a into develop Jun 10, 2020
@chrisbreiding chrisbreiding deleted the issue-7590-uncaught-string-error branch April 5, 2022 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-cross-origin uncaught error messages are left undefined
3 participants