renderErrorPanel renders the error details panel when in error state.
(width, height int)
| 536 | |
| 537 | // renderErrorPanel renders the error details panel when in error state. |
| 538 | func (a *App) renderErrorPanel(width, height int) string { |
| 539 | var content strings.Builder |
| 540 | |
| 541 | // Error header |
| 542 | errorIcon := statusFailedStyle.Render(IconFailed) |
| 543 | errorTitle := StateErrorStyle.Render("ERROR") |
| 544 | content.WriteString(fmt.Sprintf("%s %s\n", errorIcon, errorTitle)) |
| 545 | content.WriteString(DividerStyle.Render(strings.Repeat("─", width-4))) |
| 546 | content.WriteString("\n\n") |
| 547 | |
| 548 | // Error message |
| 549 | content.WriteString(labelStyle.Render("Error Details")) |
| 550 | content.WriteString("\n") |
| 551 | if a.err != nil { |
| 552 | errorMsg := a.err.Error() |
| 553 | content.WriteString(wrapText(errorMsg, width-4)) |
| 554 | } else { |
| 555 | content.WriteString(lipgloss.NewStyle().Foreground(MutedColor).Render("Unknown error occurred")) |
| 556 | } |
| 557 | content.WriteString("\n\n") |
| 558 | |
| 559 | // Log file hint |
| 560 | content.WriteString(DividerStyle.Render(strings.Repeat("─", width-4))) |
| 561 | content.WriteString("\n\n") |
| 562 | hintStyle := lipgloss.NewStyle().Foreground(WarningColor) |
| 563 | logName := "claude.log" |
| 564 | if a.provider != nil { |
| 565 | logName = a.provider.LogFileName() |
| 566 | } |
| 567 | content.WriteString(hintStyle.Render(fmt.Sprintf("💡 Tip: Check %s in the PRD directory for full error details.", logName))) |
| 568 | content.WriteString("\n\n") |
| 569 | |
| 570 | // Retry instructions |
| 571 | content.WriteString(labelStyle.Render("What to do")) |
| 572 | content.WriteString("\n") |
| 573 | content.WriteString("• Press ") |
| 574 | content.WriteString(ShortcutKeyStyle.Render("s")) |
| 575 | content.WriteString(" to retry\n") |
| 576 | content.WriteString("• Press ") |
| 577 | content.WriteString(ShortcutKeyStyle.Render("t")) |
| 578 | content.WriteString(" to view the log\n") |
| 579 | content.WriteString("• Press ") |
| 580 | content.WriteString(ShortcutKeyStyle.Render("q")) |
| 581 | content.WriteString(" to quit") |
| 582 | |
| 583 | return panelStyle.Width(width).Height(height).Render(content.String()) |
| 584 | } |
| 585 | |
| 586 | // renderEmptyPRDPanel renders a panel when there are no stories in the PRD. |
| 587 | func (a *App) renderEmptyPRDPanel(width, height int) string { |
no test coverage detected