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
const result =simpleProcedure('hello'); // Direct call
243
243
```
@@ -267,28 +267,28 @@ const asyncAgent = zagora()
267
267
268
268
Agents built with Zagora are composable, testable, and maintain type safety throughout the application lifecycle.
269
269
270
+
---
271
+
270
272
## Rules and Special Notes for Zagora usage
271
273
272
274
The following rules outlines critical points, edge cases, and things to be careful about when using Zagora. These are derived from specially noted sections, examples, and warnings in the documentation.
273
275
274
-
## Error Handling
276
+
###Error Handling Cautions
275
277
276
-
### Uppercase Error Keys
278
+
####Uppercase Error Keys
277
279
-**Caution**: All keys in the error map must be uppercased (e.g., `NOT_FOUND`, not `not_found`). TypeScript will report a type error if not.
278
280
-**Why**: These keys represent error "kinds" and are used in `result.error.kind`.
279
281
280
-
### Error Helper Validation
282
+
####Error Helper Validation
281
283
-**Caution**: If you pass invalid or missing keys to error helpers (e.g., `errors.NOT_FOUND({ invalidKey: 'value' })`), you get a `VALIDATION_ERROR` with a `key` property indicating which error validation failed.
282
284
-**Example**: `throw errors.RATE_LIMIT({ retryAfter: 'invalid' })` → `VALIDATION_ERROR` because `retryAfter` expects a number.
283
285
-**Tip**: Use `.strict()` on error schemas to throw on unknown keys: `z.object({...}).strict()`.
284
286
285
-
### Error Type Guards
287
+
####Error Type Guards
286
288
-**Caution**: Use `isValidationError`, `isInternalError`, `isDefinedError`, `isZagoraError` to narrow error types safely.
287
289
-**Note**: Even syntax errors in handlers return `ZagoraResult` with error, never crashing the process.
288
290
289
-
## Context Management
290
-
291
-
### Context Merging
291
+
### Context Merging and Management
292
292
-**Caution**: Initial context (from `.context()`) is deep-merged with runtime context (from `.callable({ context })`).
const result =simpleProcedure('hello'); // Direct call
243
243
```
@@ -267,28 +267,28 @@ const asyncAgent = zagora()
267
267
268
268
Agents built with Zagora are composable, testable, and maintain type safety throughout the application lifecycle.
269
269
270
+
---
271
+
270
272
## Rules and Special Notes for Zagora usage
271
273
272
274
The following rules outlines critical points, edge cases, and things to be careful about when using Zagora. These are derived from specially noted sections, examples, and warnings in the documentation.
273
275
274
-
## Error Handling
276
+
###Error Handling Cautions
275
277
276
-
### Uppercase Error Keys
278
+
####Uppercase Error Keys
277
279
-**Caution**: All keys in the error map must be uppercased (e.g., `NOT_FOUND`, not `not_found`). TypeScript will report a type error if not.
278
280
-**Why**: These keys represent error "kinds" and are used in `result.error.kind`.
279
281
280
-
### Error Helper Validation
282
+
####Error Helper Validation
281
283
-**Caution**: If you pass invalid or missing keys to error helpers (e.g., `errors.NOT_FOUND({ invalidKey: 'value' })`), you get a `VALIDATION_ERROR` with a `key` property indicating which error validation failed.
282
284
-**Example**: `throw errors.RATE_LIMIT({ retryAfter: 'invalid' })` → `VALIDATION_ERROR` because `retryAfter` expects a number.
283
285
-**Tip**: Use `.strict()` on error schemas to throw on unknown keys: `z.object({...}).strict()`.
284
286
285
-
### Error Type Guards
287
+
####Error Type Guards
286
288
-**Caution**: Use `isValidationError`, `isInternalError`, `isDefinedError`, `isZagoraError` to narrow error types safely.
287
289
-**Note**: Even syntax errors in handlers return `ZagoraResult` with error, never crashing the process.
288
290
289
-
## Context Management
290
-
291
-
### Context Merging
291
+
### Context Merging and Management
292
292
-**Caution**: Initial context (from `.context()`) is deep-merged with runtime context (from `.callable({ context })`).
0 commit comments