mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 10:03:27 +00:00
fix(hooks): add stack traces to hook errors, fix tools.ts theme bug
- HookError now includes optional stack field - Hook error display shows stack trace in dim color below error message - tools.ts: create SettingsListTheme using the theme passed to ctx.ui.custom() instead of using getSettingsListTheme() which depends on global theme
This commit is contained in:
parent
91fae8b2f0
commit
6390ff87ef
4 changed files with 34 additions and 6 deletions
|
|
@ -410,10 +410,12 @@ export class HookRunner {
|
|||
}
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
const stack = err instanceof Error ? err.stack : undefined;
|
||||
this.emitError({
|
||||
hookPath: hook.path,
|
||||
event: event.type,
|
||||
error: message,
|
||||
stack,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -477,10 +479,12 @@ export class HookRunner {
|
|||
}
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
const stack = err instanceof Error ? err.stack : undefined;
|
||||
this.emitError({
|
||||
hookPath: hook.path,
|
||||
event: "context",
|
||||
error: message,
|
||||
stack,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -523,10 +527,12 @@ export class HookRunner {
|
|||
}
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
const stack = err instanceof Error ? err.stack : undefined;
|
||||
this.emitError({
|
||||
hookPath: hook.path,
|
||||
event: "before_agent_start",
|
||||
error: message,
|
||||
stack,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -911,4 +911,5 @@ export interface HookError {
|
|||
hookPath: string;
|
||||
event: string;
|
||||
error: string;
|
||||
stack?: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue