Skip to content

Commit e329852

Browse files
committed
Detect if DOMException exists via typeof instead of trying to call it and catching the exception which may get thrown
fixes #724
1 parent a0dcd85 commit e329852

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fetch.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,8 @@ Response.redirect = function(url, status) {
455455
}
456456

457457
export var DOMException = global.DOMException
458-
try {
459-
new DOMException()
460-
} catch (err) {
458+
459+
if (typeof DOMException !== 'function') {
461460
DOMException = function(message, name) {
462461
this.message = message
463462
this.name = name

0 commit comments

Comments
 (0)