mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 07:10:55 +00:00
fix(cli): harden /btw command error handling and type safety
- Add null/undefined guard in formatBtwError to avoid "null"/"undefined" strings - Add type guard for btw property in HistoryItemDisplay to prevent crash - Extract isBtwCommand regex to module-level constant and simplify with [/?] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
905f2c3f36
commit
13423f0676
3 changed files with 8 additions and 9 deletions
|
|
@ -21,7 +21,8 @@ function makeBtwPromptId(sessionId: string): string {
|
|||
|
||||
function formatBtwError(error: unknown): string {
|
||||
return t('Failed to answer btw question: {{error}}', {
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
error:
|
||||
error instanceof Error ? error.message : String(error || 'Unknown error'),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue