Skip to content

Commit 527d6d5

Browse files
committed
fix: adapt error to work on IE9
1 parent fba79db commit 527d6d5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/history/errors.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
export class NavigationDuplicated extends Error {
22
constructor () {
33
super('Navigating to current location is not allowed')
4-
this.name = 'NavigationDuplicated'
4+
this.name = this._name = 'NavigationDuplicated'
55
}
66
}
7+
8+
// support IE9
9+
NavigationDuplicated._name = 'NavigationDuplicated'

src/util/warn.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ export function isError (err: any): boolean {
1717
}
1818

1919
export function isExtendedError (constructor: Function, err: any): boolean {
20-
return err instanceof constructor || (err && err.name === constructor.name)
20+
return (
21+
err instanceof constructor ||
22+
// _name is to support IE9 too
23+
(err && (err.name === constructor.name || err._name === constructor._name))
24+
)
2125
}

0 commit comments

Comments
 (0)