mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-18 11:31:07 +00:00
fix($location): throw Errors not Strings
This commit is contained in:
parent
d9ff5fd432
commit
ee6014a3aa
1 changed files with 4 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ function convertToHashbangUrl(url, basePath, hashPrefix) {
|
||||||
path = match.path.substr(pathPrefix.length);
|
path = match.path.substr(pathPrefix.length);
|
||||||
|
|
||||||
if (match.path.indexOf(pathPrefix) !== 0) {
|
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 +
|
return composeProtocolHostPort(match.protocol, match.host, match.port) + basePath +
|
||||||
|
|
@ -114,7 +114,7 @@ function LocationUrl(url, pathPrefix) {
|
||||||
var match = matchUrl(url, this);
|
var match = matchUrl(url, this);
|
||||||
|
|
||||||
if (match.path.indexOf(pathPrefix) !== 0) {
|
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));
|
this.$$path = decodeURIComponent(match.path.substr(pathPrefix.length));
|
||||||
|
|
@ -160,8 +160,9 @@ function LocationHashbangUrl(url, hashPrefix) {
|
||||||
this.$$parse = function(url) {
|
this.$$parse = function(url) {
|
||||||
var match = matchUrl(url, this);
|
var match = matchUrl(url, this);
|
||||||
|
|
||||||
|
|
||||||
if (match.hash && match.hash.indexOf(hashPrefix) !== 0) {
|
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 : '');
|
basePath = match.path + (match.search ? '?' + match.search : '');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue