nuxt
nuxt copied to clipboard
showError doesn't trigger `app:error` (anymore?)
Environment
- Operating System: Linux
- Node Version: v18.18.0
- Nuxt Version: 3.11.2
- CLI Version: 3.11.1
- Nitro Version: 2.9.6
- Package Manager: [email protected]
- Builder: -
- User Config: devtools
- Runtime Modules: -
- Build Modules: -
Reproduction
https://stackblitz.com/edit/github-khtc7d?file=plugins%2Ferror-handler.js,app.vue
Describe the bug
showError is supposed to trigger the app:error hook.
However this doesn't seem to work (anymore). I'm sure it used to work in the past.
You can see the hook registering properly in the plugin, but the actual log message on error never shows up.
I also tried throwing createError, but that also yields no results.
Additional context
I noticed the docs now discourage using showError, which is new to me, but that has the same result.
Logs
No response
This seems to be working for me.
You can see the implementation here, which does call the hook:
https://github.com/nuxt/nuxt/blob/8a759bc6fe402bb6fc8dc0ae25401992a16d5880/packages/nuxt/src/app/composables/error.ts#L18-L40
Would you be able to provide a reproduction? 🙏
More info
Why do I need to provide a reproduction?
Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.
What will happen?
If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.
If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.
How can I create a reproduction?
We have a couple of templates for starting with a minimal reproduction:
👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz 👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox
A public GitHub repository is also perfect. 👌
Please ensure that the reproduction is as minimal as possible. See more details in our guide.
You might also find these other articles interesting and/or helpful:
Oh, now it indeed started working again.
My repro 100% did not work before (and I had the same behaviour locally), so maybe this was fixed in the meantime? Did Nitro update recently without Nuxt updating minor versions, or some other dep that might've caused this?
Anyway: this can be closed it seems!
Hm. I don't know what might have been causing this to fail, but it should be purely a Nuxt behaviour, and one that hasn't changed since you opened the repro...