mirror of
https://github.com/we-promise/sure.git
synced 2026-05-09 13:45:01 +00:00
* Improve chat LLM error messages * Fix chat visibility regression in tests * Harden chat error handling for review feedback * Fix rubocop private method indentation * Fix nil presentable_error_message, i18n strings, bare rescue - Guard `presentable_error_message` with `return nil if error.blank?` so chats with no error return nil instead of the fallback string; this prevents the API serialisers from emitting a spurious error message and stops the mobile polling guard from firing on every successful chat - Move all hardcoded user-facing error strings into config/locales/models/chat/en.yml and reference them via I18n.t() - Replace bare `rescue` in `error_message_for` with `rescue StandardError` to avoid swallowing system-level exceptions - Update tests to reference I18n keys instead of raw strings, and add tests for the nil-error case and the unrecognized-error fallback https://claude.ai/code/session_01YFMjEds5WVyKPL42xBqMCX --------- Co-authored-by: SureBot <sure-bot@we-promise.com> Co-authored-by: Claude <noreply@anthropic.com>
19 lines
535 B
Plaintext
19 lines
535 B
Plaintext
<%# locals: (chat:) %>
|
|
|
|
<div id="chat-error" class="px-3 py-2 bg-red-100 border border-red-500 rounded-lg">
|
|
<% if chat.debug_mode? %>
|
|
<div class="overflow-x-auto text-xs p-4 bg-red-200 rounded-md mb-2">
|
|
<code><%= chat.technical_error_message %></code>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="flex items-center justify-between gap-2">
|
|
<p class="text-xs text-red-500"><%= chat.presentable_error_message %></p>
|
|
|
|
<%= render DS::Button.new(
|
|
text: "Retry",
|
|
href: retry_chat_path(chat),
|
|
) %>
|
|
</div>
|
|
</div>
|