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

Change getService() to throw error when service does not exist #103

Merged
merged 1 commit into from
Sep 11, 2015

Conversation

j3tan
Copy link
Contributor

@j3tan j3tan commented Sep 8, 2015

  • Added hasService() method to allow for optional services
  • debug off = fires an error and returns null

fixes #89

@boxcla
Copy link

boxcla commented Sep 8, 2015

Verified that @j3tan has signed the CLA. Thanks for the pull request!

@j3tan
Copy link
Contributor Author

j3tan commented Sep 9, 2015

@jdivock @nzakas - please check this out to see if this works as you would expect it to.

* @returns {boolean} True, if service exist. False, otherwise.
*/
hasService: function(serviceName) {
return serviceName in services;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd switch to hasOwnProperty() here. Right now, this will return true when serviceName is toString, hasOwnProperty, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done for all

@j3tan j3tan force-pushed the throw_errors_for_non_existent_services branch from 56802c1 to aac1ca8 Compare September 11, 2015 17:34
@nzakas
Copy link
Contributor

nzakas commented Sep 11, 2015

+2

j3tan added a commit that referenced this pull request Sep 11, 2015
Change getService() to throw error when service does not exist
@j3tan j3tan merged commit 7102d86 into master Sep 11, 2015
@j3tan j3tan deleted the throw_errors_for_non_existent_services branch September 11, 2015 20:23
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

Successfully merging this pull request may close these issues.

Make T3 throw or warn when attempting to retrieve a service that doesn't exist in debug mode
3 participants