Skip to content

Commit

Permalink
Detect if DOMException exists via typeof instead of trying to call it…
Browse files Browse the repository at this point in the history
… and catching the exception which may get thrown

fixes JakeChampion/fetch#724
  • Loading branch information
cr313 committed Jul 9, 2020
1 parent 3f80edb commit 1c2fce2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fetch.js
Expand Up @@ -455,9 +455,8 @@ Response.redirect = function(url, status) {
}

export var DOMException = global.DOMException
try {
new DOMException()
} catch (err) {

if (typeof DOMException !== 'function') {
DOMException = function(message, name) {
this.message = message
this.name = name
Expand Down

0 comments on commit 1c2fce2

Please sign in to comment.