aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/location.js
diff options
context:
space:
mode:
authorIgor Minar2012-06-12 00:18:54 -0700
committerIgor Minar2012-06-12 00:27:24 -0700
commitee6014a3aa90232ed263fe9c9e0860c777b37a30 (patch)
tree0267b642867a1d7b73de55625a426c9ab126d364 /src/ng/location.js
parentd9ff5fd432314d2b5f5e6766240c918f10d3b83d (diff)
downloadangular.js-ee6014a3aa90232ed263fe9c9e0860c777b37a30.tar.bz2
fix($location): throw Errors not Strings
Diffstat (limited to 'src/ng/location.js')
-rw-r--r--src/ng/location.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ng/location.js b/src/ng/location.js
index 30509062..00f21559 100644
--- a/src/ng/location.js
+++ b/src/ng/location.js
@@ -85,7 +85,7 @@ function convertToHashbangUrl(url, basePath, hashPrefix) {
path = match.path.substr(pathPrefix.length);
if (match.path.indexOf(pathPrefix) !== 0) {
- throw 'Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !';
+ throw Error('Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !');
}
return composeProtocolHostPort(match.protocol, match.host, match.port) + basePath +
@@ -114,7 +114,7 @@ function LocationUrl(url, pathPrefix) {
var match = matchUrl(url, this);
if (match.path.indexOf(pathPrefix) !== 0) {
- throw 'Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !';
+ throw Error('Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !');
}
this.$$path = decodeURIComponent(match.path.substr(pathPrefix.length));
@@ -160,8 +160,9 @@ function LocationHashbangUrl(url, hashPrefix) {
this.$$parse = function(url) {
var match = matchUrl(url, this);
+
if (match.hash && match.hash.indexOf(hashPrefix) !== 0) {
- throw 'Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '" !';
+ throw Error('Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '" !');
}
basePath = match.path + (match.search ? '?' + match.search : '');