improv: surface errors
This commit is contained in:
parent
431db20611
commit
41774ee373
1 changed files with 5 additions and 2 deletions
|
|
@ -123,8 +123,11 @@ async function processMessage(
|
|||
// Save session after each successful response
|
||||
saveSession(chatHistory);
|
||||
} catch (e: any) {
|
||||
logger.error(`\n${chalk.red(`Error: ${formatError(e)}`)}`);
|
||||
if (!isHeadless) {
|
||||
// In headless mode, ensure errors are visible on stderr
|
||||
if (isHeadless) {
|
||||
console.error(chalk.red(`Error: ${formatError(e)}`));
|
||||
} else {
|
||||
logger.error(`\n${chalk.red(`Error: ${formatError(e)}`)}`);
|
||||
logger.info(
|
||||
chalk.dim(`Chat history:\n${JSON.stringify(chatHistory, null, 2)}`)
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue