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

Hard-to-locate error when providing wrong parameter type to mapState #1162

Closed
joachimboggild opened this issue Feb 21, 2018 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@joachimboggild
Copy link

Version

3.0.1

Reproduction link

https://codesandbox.io/s/048lw4q59n

Steps to reproduce

  1. Open code sandbox provided.
  2. Look inside console to the error message provided.

To fix the problem, include brackets inside the mapState statement on line 97 in the HelloWorld.vue file.

What is expected?

It was expected that an error message would state that the parameter for the mapState function was invalid in 'HelloWorld.vue'.

What is actually happening?

This error message is returned:

[Vue warn]: Failed to resolve async component: function HelloWorld() {
  return _promise2.default.resolve().then(function () {
    return require("./components/HelloWorld");
  });
}
Reason: TypeError: Cannot convert undefined or null to object

I just thought that this was a difficult error to track, because the error message provided did not point towards the actual error. If it is possible to make the error message more precise, it would be great.

@ktsn ktsn added the enhancement New feature or request label Feb 21, 2018
@yawboakye
Copy link

@ktsn Current implementation is confident that either an array or object is always passed, which explains the cryptic error & message: it's not stop earlier. What would you expect to be the behavior when you pass something other than that?

@EdyHartono
Copy link
Contributor

#1297

@sustained
Copy link

Hope that PR makes it in, this has bitten me twice so far.

Maybe I'll learn my lesson (if not after this time then) eventually but it will probably keep biting people.

@ktsn
Copy link
Member

ktsn commented Nov 10, 2019

fixed via #1297

@ktsn ktsn closed this as completed Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants