nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

showError doesn't trigger `app:error` (anymore?)

Open TheDutchCoder opened this issue 1 year ago • 1 comments

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. image

Logs

No response

TheDutchCoder avatar May 10 '24 13:05 TheDutchCoder

This seems to be working for me.

CleanShot 2024-05-24 at 17 36 00@2x

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

danielroe avatar May 24 '24 16:05 danielroe

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:

github-actions[bot] avatar May 24 '24 16:05 github-actions[bot]

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!

TheDutchCoder avatar May 24 '24 18:05 TheDutchCoder

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...

danielroe avatar May 24 '24 20:05 danielroe