Skip to content

Commit 0dae380

Browse files
nenizerakodster28
andauthored
[Workers] Update tcp-sockets.mdx (#22539)
* [Workers] Update tcp-sockets.mdx Let's link it to the try...catch docs for more info and examples. * Update src/content/docs/workers/runtime-apis/tcp-sockets.mdx --------- Co-authored-by: Kody Jackson <[email protected]>
1 parent dcd381e commit 0dae380

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/docs/workers/runtime-apis/tcp-sockets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const secureSocket = socket.startTls();
143143

144144
## Handle errors
145145

146-
To handle errors when creating a new TCP socket, reading from a socket, or writing to a socket, wrap these calls inside `try..catch` blocks. The following example opens a connection to Google.com, initiates a HTTP request, and returns the response. If any of this fails and throws an exception, it returns a `500` response:
146+
To handle errors when creating a new TCP socket, reading from a socket, or writing to a socket, wrap these calls inside [`try/catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch) statement blocks. The following example opens a connection to Google.com, initiates a HTTP request, and returns the response. If this fails and throws an exception, it returns a `500` response:
147147

148148
```typescript
149149
import { connect } from 'cloudflare:sockets';

0 commit comments

Comments
 (0)