You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.bs
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -135,10 +135,10 @@ following circumstances:
135
135
Whether the promise should resolve without the ReadableStream being read is up for discussion.
136
136
</div>
137
137
138
-
It can also be rejected with an exception under the following circumstances:
138
+
It can also be rejected with an [[#socket-error]] under the following circumstances:
139
139
140
-
* a socket connection could not be established, either because the address/port combo requested is
141
-
blocked or due to a transient issue with the runtime
140
+
* a socket connection could not be established, either because the address/port combo requested is blocked
141
+
* due to a transient issue with the runtime
142
142
143
143
Cancelling the socket's ReadableStream and closing the socket's WritableStream does not resolve the
144
144
`closed` promise.
@@ -215,11 +215,11 @@ The `connect` method performs the following steps:
215
215
<li>A connection is established to the specified `SocketAddress` asynchronously.</li>
216
216
<li>New {{Socket}} instance is created with each of its attributes initialised immediately.</li>
217
217
<li>The created {{Socket}} instance is returned immediately.</li>
218
-
<li>If the connection fails for any reason, the socket's `closed` promise is rejected with an exception describing why the connection failed.</li>
218
+
<li>If the connection fails for any reason, the socket's `closed` promise is rejected with a [[#socket-error]] exception describing why the connection failed.</li>
219
219
<li>The instance's {{ReadableStream}} and {{WritableStream}} streams can be used immediately.</li>
220
220
</ol>
221
221
222
-
At any point during the creation of the {{Socket}} instance, `connect` may throw an exception. One
222
+
At any point during the creation of the {{Socket}} instance, `connect` may throw a [[#socket-error]] exception. One
223
223
case where this can happen is if the input address is incorrectly formatted.
224
224
Errors which occur asynchronously- after the socket instance has been returned- must reject the
225
225
socket's `closed` promise.
@@ -232,8 +232,18 @@ socket's `closed` promise.
232
232
to avoid connecting to private services hosted locally (or on the server's LAN).
233
233
</div>
234
234
235
+
SocketError {#socket-error}
236
+
---------------------------
237
+
238
+
`SocketError` is an instance of {{TypeError}}. The error message should start with `"SocketError: "`.
235
239
240
+
For example,
241
+
242
+
```javascript
243
+
throw new SocketError('connection failed');
244
+
```
236
245
246
+
Should result in the following error: `Uncaught SocketError [TypeError]: SocketError: connection failed`.
0 commit comments