From b8ea7f6aba2e675b85826b0bee1f21ddd7b866a5 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 24 May 2013 11:00:14 -0700 Subject: feat(ngError): add error message compression and better error messages - add toThrowNg matcher --- src/ng/controller.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/ng/controller.js') diff --git a/src/ng/controller.js b/src/ng/controller.js index 5c19cf88..2df0bde9 100644 --- a/src/ng/controller.js +++ b/src/ng/controller.js @@ -74,9 +74,8 @@ function $ControllerProvider() { instance = $injector.instantiate(expression, locals); if (identifier) { - if (typeof locals.$scope !== 'object') { - throw new Error('Can not export controller as "' + identifier + '". ' + - 'No scope object provided!'); + if (!(locals && typeof locals.$scope == 'object')) { + throw ngError(47, "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.", constructor || expression.name, identifier); } locals.$scope[identifier] = instance; -- cgit v1.2.3