mirror of
https://github.com/cline/cline.git
synced 2026-09-19 02:05:44 +08:00
logging: guard HostProvider.get().logToChannel with try/catch; console fallback for early startup (IntelliJ plugin)
This commit is contained in:
@@ -32,7 +32,13 @@ export class Logger {
|
||||
if (error?.message) {
|
||||
fullMessage += ` ${error.message}`
|
||||
}
|
||||
HostProvider.get().logToChannel(`${level} ${fullMessage}`)
|
||||
// During early startup, HostProvider may not be initialized yet.
|
||||
// In that case, fall back to console logging instead of throwing.
|
||||
try {
|
||||
HostProvider.get().logToChannel(`${level} ${fullMessage}`)
|
||||
} catch {
|
||||
console.log(`${level} ${fullMessage}`)
|
||||
}
|
||||
if (error?.stack) {
|
||||
console.log(`Stack trace:\n${error.stack}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user