Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore(angular.module): improve the 'No module' error message #2695

Closed
wants to merge 1 commit into from
Closed

chore(angular.module): improve the 'No module' error message #2695

wants to merge 1 commit into from

Conversation

bripkens
Copy link
Contributor

Whether or not the 'requires' parameter of 'angular.module' is optional
depends on the state of the application. The thrown error message is
not very descriptive and can be improved. For instance, the error
could contain a hint that the parameter is required for initial
module creation.

The improvement is based on comments under the angular.module documentation.

Whether or not the 'requires' parameter of 'angular.module' is optional
depends on the state of the application. The thrown error message is
not very descriptive and can be improved. For instance, the error
could contain a hint that the parameter is required for initial
module creation.
@petebacondarwin
Copy link
Contributor

I understand where you are coming from but I think that this is only a small part of the bigger API problem. For instance if you accidentally use [] twice then you get no error message at all and it quietly overwrites your previous definitions.
In the long run I think we ought to deprecate this API altogether and use something like: defineModule and updateModule to make our intention clear, where the former requires the dependencies and the latter refuses them.

Currently this fix only adds extra bytes to the build without really solving the problem. I would vote to close this for now and work towards a more comprehensive solution.

@kstep
Copy link
Contributor

kstep commented May 20, 2013

While I agree with @petebacondarwin about more comprehensive solution, I think @bripkens patch is good enough for now, until better solution is ready. At least newcomers will be able to understand what AngularJS wants of them for this concrete case, which is not very uncommon for beginners.

@petebacondarwin
Copy link
Contributor

PR Checklist (Minor Bugfix)

  • Contributor signed CLA now or in the past (if you just signed, leave a comment here with your real name)
  • PR doesn't introduce new api
  • PR doesn't contain a breaking change
  • PR contains unit tests
  • PR contains e2e tests (if suitable)
  • PR contains documentation update (if suitable)
  • PR passes all tests on Travis (sanity)
  • PR passes all tests on ci.angularjs.org (cross-browser compatibility)
  • PR is rebased against recent master
  • PR is squashed into one commit per logical change
  • PR's commit messages are descriptive and allows us to autogenerate release notes (required commit message format)
  • All changes requested in review have been implemented

@petebacondarwin
Copy link
Contributor

Hi @bripkens - can you sign the CLA?
Also we are now using minErr to generate our error messages. Can you rework this PR to use that?
Thanks

IgorMinar added a commit to IgorMinar/angular.js that referenced this pull request Jul 11, 2013
@IgorMinar
Copy link
Contributor

I've reimplemented this change using the new error messaging "framework" we now use. Thanks for the suggestion.

@IgorMinar IgorMinar closed this Jul 11, 2013
ctrahey pushed a commit to ctrahey/angular.js that referenced this pull request Jul 22, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants