-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
renderToString()
swallows errors
#7876
Comments
wow !The logError method does not throw an exception error in the production environment, but only prints the error. I think this is done to avoid the exception error throwing and causing the program to stop or crash. Perhaps vue can add an option for the user to determine whether to throw an exception error in the production environment, but it is actually a big change, involving error handling at runtime, and also needs to expand the compiler options (for example, the slot call code is generated by the compiler, not simply modifying the runtime can be achieved) |
Just to reiterate that, from the perspective of vite-plugin-ssr users, I think this should labeled as |
Does I'm not familiar with the internals of
|
Are you successful in a production environment? I was troubleshooting and found that
|
Indeed, this seems to be a viable workaround. @baiwusanyu-c This is how I made it work: brillout/vue-renderToString-bug@68c0707. |
Now that there's a workaround, I would like to label this issue as "p3: minor bug". A side note: |
Makes sense 👍 and thanks for the pointers. |
I'm having the same problem. I hope there can be an option here to decide whether to throw an error or not. |
closed via f476b7f This will be possible in 3.5: app.config.throwUnhandledErrorInProduction = true The default behavior cannot be changed because it would result in crashes in production for those who didn't previously set |
Vue version
3.2.47
Link to minimal reproduction
https://github.com/brillout/vue-renderToString-bug
Steps to reproduce
See https://github.com/brillout/vue-renderToString-bug#readme.
What is expected?
renderToString()
swallows errors occuring in Vue SFC<script>
.Note that
renderToString()
does log the error (console.error(error)
) but it doesn't throw it (throw error
).What is actually happening?
renderToString()
should throw the error so that erroneous state can be detected and handled accordingly.System Info
No response
Any additional comments?
I don't see any workaround.
Checking whether
conole.error()
was called duringrenderToString()
cannot be used to detect whether an error occured, becauserenderToString()
isasync
.See vikejs/vike#687 – I consider this a critical bug as showing a blank page instead of an error page is a considerable UX degradation.
The text was updated successfully, but these errors were encountered: