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

[5.12] Non helpful error when the function for on modifier was forget to add #20783

Open
mkszepp opened this issue Oct 25, 2024 · 4 comments
Open

Comments

@mkszepp
Copy link
Contributor

mkszepp commented Oct 25, 2024

🐞 Describe the Bug

Beginning with ember v5.12 the error handing is not helpful when you forget to create the pass function to on modifier.

🔬 Minimal Reproduction

Create a hbs file with this content:

<div {{on "click" this.myfunction}}></div>

Minimal reproduction: https://github.com/mkszepp/ember-missing-action-function

😕 Actual Behavior

If you forget to create the function in js/ts you will get this error:
Error in Firefox:
Unhelpful error when there was not function passed to on modifier
grafik

Error in Chrome:
Uncaught TypeError: Cannot read properties of undefined (reading 'bind')
grafik

🤔 Expected Behavior

We should bring back better error handling like it was in <= v5.11

Uncaught Error: You must pass a function as the second argument to the `on` modifier; you passed undefined. While rendering:

this.myfunction

grafik

🌍 Environment

  • Ember: 5.12.0
  • Ember-CLI: 5.12.0
  • Node.js/pnpm: v20 / v9
  • OS: Linux / WIndows
  • Browser: Firefox / Chrome
@mkszepp mkszepp changed the title Non helpful error when the function for on modifier was forget to add [5.12] Non helpful error when the function for on modifier was forget to add Oct 25, 2024
@NullVoxPopuli
Copy link
Contributor

def a bug!

in your 5.11 stack, what function (and from where) prints that nicer message?

@mkszepp
Copy link
Contributor Author

mkszepp commented Oct 25, 2024

@mkszepp
Copy link
Contributor Author

mkszepp commented Oct 25, 2024

@NullVoxPopuli
Copy link
Contributor

oofta -- that check stuff in general is supposed to be stripped during glimmer-vm publish.

thank you for finding and reporting this!!!

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

No branches or pull requests

2 participants