Skip to content

Commit f68e9c2

Browse files
trojanmartinMartin
andauthored
fix: enhance error logging in runCommand and add session status retry messages (#8)
Co-authored-by: Martin <trojan@datapac.sk>
1 parent 1068f2e commit f68e9c2

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/command.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ export async function runCommand(config: ResolvedRunConfig): Promise<void> {
163163
`${response}${footer}`
164164
)
165165
} catch (err) {
166-
console.error("Error during command mode run:", (err as Error).message)
166+
const error = err as Error
167+
console.error("Error during command mode run:", error.message)
168+
console.error(error.stack)
167169
throw err
168170
} finally {
169171
if (opencode) {

src/opencode.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ export function subscribeToSessionEvents(server: OpencodeServer, session: Openco
150150
console.log()
151151
}
152152
}
153+
} else if (evt.type === "session.status") {
154+
const status = evt.properties.status as Record<string, unknown>
155+
if (status.type === "retry") {
156+
const message = status.message as string
157+
console.log(`\x1b[31m${message}\x1b[0m\n`)
158+
console.log(`\n\x1b[33m\x1b[1m[Retrying... (Attempt ${status.attempt as number})]\x1b[0m\n`)
159+
}
153160
}
154161
}
155162

0 commit comments

Comments
 (0)