Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit ee6014a

Browse files
committed
fix($location): throw Errors not Strings
1 parent d9ff5fd commit ee6014a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ng/location.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function convertToHashbangUrl(url, basePath, hashPrefix) {
8585
path = match.path.substr(pathPrefix.length);
8686

8787
if (match.path.indexOf(pathPrefix) !== 0) {
88-
throw 'Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !';
88+
throw Error('Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !');
8989
}
9090

9191
return composeProtocolHostPort(match.protocol, match.host, match.port) + basePath +
@@ -114,7 +114,7 @@ function LocationUrl(url, pathPrefix) {
114114
var match = matchUrl(url, this);
115115

116116
if (match.path.indexOf(pathPrefix) !== 0) {
117-
throw 'Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !';
117+
throw Error('Invalid url "' + url + '", missing path prefix "' + pathPrefix + '" !');
118118
}
119119

120120
this.$$path = decodeURIComponent(match.path.substr(pathPrefix.length));
@@ -160,8 +160,9 @@ function LocationHashbangUrl(url, hashPrefix) {
160160
this.$$parse = function(url) {
161161
var match = matchUrl(url, this);
162162

163+
163164
if (match.hash && match.hash.indexOf(hashPrefix) !== 0) {
164-
throw 'Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '" !';
165+
throw Error('Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '" !');
165166
}
166167

167168
basePath = match.path + (match.search ? '?' + match.search : '');

0 commit comments

Comments
 (0)