Skip to content
This repository was archived by the owner on May 5, 2020. It is now read-only.

Commit d6bb0a5

Browse files
committed
Use err.name to classify exception
This throws `Uncaught ReferenceError: SecurityError is not defined`: catch(err){ // ... err instanceof SecurityError ? 'BadSecurity' : 'BadArgs', // ... } Testing the string err.name to equal a string literal works: catch(err){ // ... err.name == 'SecurityError' ? 'BadSecurity' : 'BadArgs', // ... }
1 parent 620c648 commit d6bb0a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Native/WebSocket.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function open(url, settings)
1111
catch(err)
1212
{
1313
return callback(_elm_lang$core$Native_Scheduler.fail({
14-
ctor: err instanceof SecurityError ? 'BadSecurity' : 'BadArgs',
14+
ctor: err.name == 'SecurityError' ? 'BadSecurity' : 'BadArgs',
1515
_0: err.message
1616
}));
1717
}
@@ -74,7 +74,7 @@ function close(code, reason, socket)
7474
catch(err)
7575
{
7676
return callback(_elm_lang$core$Native_Scheduler.fail({
77-
ctor: err instanceof SyntaxError ? 'BadReason' : 'BadCode',
77+
ctor: err.name == 'SyntaxError' ? 'BadReason' : 'BadCode',
7878
_0: err.message
7979
}));
8080
}

0 commit comments

Comments
 (0)