Skip to content

Commit 78e149a

Browse files
Benoit Traversclaude
authored andcommitted
docs: make the matcher snippets copy-pasteable
Review follow-ups on the P.tag migration: - `docs/reference/error-model.md` and the `client.call` block in `docs/how-to/use-request-reply.md` use `P.tag(...)` in snippets that already lead with an import block, so declare `P`. - `packages/client/README.md`: `./contract` gains its `.js` extension (the repo targets Node ESM), and the cleanup line uses `client.close().get()` — `close()` is `AsyncResult<void, never>`, so a bare `await` resolves to a `Result` and swallows a close defect. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent faa74f7 commit 78e149a

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

docs/how-to/use-request-reply.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ calculate: ({ payload }) =>
4343
## Call it
4444

4545
```typescript
46+
import { P } from "unthrown";
47+
4648
const result = await client.call("calculate", { a: 2, b: 3 }, { timeoutMs: 5_000 });
4749

4850
result.match({

docs/reference/error-model.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ These are unexpected, so they surface through the **defect** channel, never as a
124124

125125
```typescript
126126
import { TechnicalError } from "@amqp-contract/core";
127+
import { P } from "unthrown";
127128

128129
result.match({
129130
ok: () => {},

packages/client/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pnpm add @amqp-contract/client
2121
```typescript
2222
import { TypedAmqpClient } from "@amqp-contract/client";
2323
import { P } from "unthrown";
24-
import { contract } from "./contract";
24+
import { contract } from "./contract.js";
2525

2626
// Create client from contract (automatically connects and waits for connection)
2727
const client = await TypedAmqpClient.create({
@@ -47,7 +47,7 @@ result.match({
4747
});
4848

4949
// Clean up
50-
await client.close();
50+
await client.close().get();
5151
```
5252

5353
## Error Handling

0 commit comments

Comments
 (0)