Skip to content

Commit

Permalink
fix: adapt error to work on IE9
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jul 24, 2019
1 parent fba79db commit 527d6d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/history/errors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export class NavigationDuplicated extends Error {
constructor () {
super('Navigating to current location is not allowed')
this.name = 'NavigationDuplicated'
this.name = this._name = 'NavigationDuplicated'
}
}

// support IE9
NavigationDuplicated._name = 'NavigationDuplicated'
6 changes: 5 additions & 1 deletion src/util/warn.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ export function isError (err: any): boolean {
}

export function isExtendedError (constructor: Function, err: any): boolean {
return err instanceof constructor || (err && err.name === constructor.name)
return (
err instanceof constructor ||
// _name is to support IE9 too
(err && (err.name === constructor.name || err._name === constructor._name))
)
}

0 comments on commit 527d6d5

Please sign in to comment.