mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-10 03:28:03 +00:00
Better IPC error logging (#9727)
This commit is contained in:
parent
edd7cc0986
commit
3f4f7c0c41
2 changed files with 10 additions and 8 deletions
|
|
@ -58,14 +58,16 @@ export class IpcClient extends EventEmitter<IpcClientEvents> {
|
|||
|
||||
private onMessage(data: unknown) {
|
||||
if (typeof data !== "object") {
|
||||
this._log("[client#onMessage] invalid data", data)
|
||||
this.log(`[client#onMessage] invalid data -> ${JSON.stringify(data)}`)
|
||||
return
|
||||
}
|
||||
|
||||
const result = ipcMessageSchema.safeParse(data)
|
||||
|
||||
if (!result.success) {
|
||||
this.log("[client#onMessage] invalid payload", result.error, data)
|
||||
this.log(
|
||||
`[client#onMessage] invalid payload -> ${JSON.stringify(result.error.issues)} -> ${JSON.stringify(data)}`,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -113,9 +115,10 @@ export class IpcClient extends EventEmitter<IpcClientEvents> {
|
|||
public disconnect() {
|
||||
try {
|
||||
ipc.disconnect(this._id)
|
||||
// @TODO: Should we set _disconnect here?
|
||||
} catch (error) {
|
||||
this.log("[client#disconnect] error disconnecting", error)
|
||||
this.log(
|
||||
`[client#disconnect] error disconnecting -> ${error instanceof Error ? error.message : String(error)}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export class IpcServer extends EventEmitter<IpcServerEvents> implements RooCodeI
|
|||
|
||||
private onMessage(data: unknown) {
|
||||
if (typeof data !== "object") {
|
||||
this.log("[server#onMessage] invalid data", data)
|
||||
this.log(`[server#onMessage] invalid data -> ${JSON.stringify(data)}`)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -84,10 +84,9 @@ export class IpcServer extends EventEmitter<IpcServerEvents> implements RooCodeI
|
|||
|
||||
if (!result.success) {
|
||||
this.log(
|
||||
"[server#onMessage] invalid paylooooad",
|
||||
JSON.stringify(result.error.format()),
|
||||
JSON.stringify(data),
|
||||
`[server#onMessage] invalid payload -> ${JSON.stringify(result.error.issues)} -> ${JSON.stringify(data)}`,
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue