docs(coding-agent): update event bus docs - async errors now caught automatically
This commit is contained in:
@@ -202,17 +202,7 @@ const unsubscribe = pi.events.on("other:event", (data) => {
|
||||
|
||||
Events are session-scoped. Use namespaced channel names like `"toolname:event"` to avoid collisions.
|
||||
|
||||
Handler errors are caught and logged. For async handlers, handle errors internally:
|
||||
|
||||
```typescript
|
||||
pi.events.on("mytool:event", async (data) => {
|
||||
try {
|
||||
await doSomething(data);
|
||||
} catch (err) {
|
||||
console.error("Handler failed:", err);
|
||||
}
|
||||
});
|
||||
```
|
||||
Handler errors (sync and async) are caught and logged.
|
||||
|
||||
### Sending Messages
|
||||
|
||||
|
||||
Reference in New Issue
Block a user