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

fix(vua-app): clone mount error to prevent mutating read-only error object #5214

Merged
merged 3 commits into from
Mar 12, 2019

Conversation

manniL
Copy link
Member

@manniL manniL commented Mar 12, 2019

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)

Resolves #5056

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@codecov-io
Copy link

codecov-io commented Mar 12, 2019

Codecov Report

Merging #5214 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #5214   +/-   ##
=======================================
  Coverage   96.32%   96.32%           
=======================================
  Files          73       73           
  Lines        2476     2476           
  Branches      628      628           
=======================================
  Hits         2385     2385           
  Misses         76       76           
  Partials       15       15

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 648062c...15618ef. Read the comment docs.

errorHandler(err)
const improvedErr = new Error('[nuxt] Error while mounting app: ' + err.message)
improvedErr.original = err
improvedErr.stack = improvedErr.stack.split('\n').slice(0,2).join('\n') + '\n' + err.stack
Copy link
Member

Choose a reason for hiding this comment

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

This is a very low-level hack which may make error handler even more unstable for different browsers / errors

Copy link
Member Author

Choose a reason for hiding this comment

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

Could be, yeah. But What would be another solution? Checking for a DOMException (and other errors with read-only values)? 🤔

Choose a reason for hiding this comment

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

Another thing is that in IE for example improvedErr.stack would be undefined and crash

new Error().stack
undefined

@pi0
Copy link
Member

pi0 commented Mar 12, 2019

@manniL Isn't new Error(error) enough to workaround readonly object?

@manniL
Copy link
Member Author

manniL commented Mar 12, 2019

Welp, that was too simple 😂

You are right @pi0 ☺️

@manniL manniL requested a review from pi0 March 12, 2019 17:49
@pi0 pi0 changed the title fix: wrap mount error due to possible read-only error msg fix(vua-app): clone mount error to prevent mutating read-only error object Mar 12, 2019
@pi0 pi0 merged commit 37006f6 into dev Mar 12, 2019
@pi0 pi0 deleted the fix/read-only-error-msg branch March 12, 2019 22:07
@pi0 pi0 mentioned this pull request Mar 14, 2019
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attempted to assign to readonly property.
5 participants