atticoos / gulp-ng-config

:wrench: Create AngularJS constants from a JSON config file
MIT License
173 stars 35 forks source link

Throw error if non existing `options.environment` was specified #39

Closed NickAb closed 9 years ago

NickAb commented 9 years ago

If options.environment was set to non existing key in configuration json, then plugin will silently fail and give back unexpected config value, that includes all existing environments. See https://github.com/ajwhite/gulp-ng-config/blob/develop/gulp-ng-config.js#L65

It would be better to throw an error, so that build could exit with non-zero code if incorrect environment was specified. Alternatively this can be made optional, so that it throws only if options.thrownOnBadEnviroment or something like that. is set.

What do you think about it?

atticoos commented 9 years ago

Good call, I think this should fail :+1: