Skip to content

fix: show fallback message when import config error is empty#1725

Open
bluzername wants to merge 1 commit intofarion1231:mainfrom
bluzername:fix/empty-import-error-message
Open

fix: show fallback message when import config error is empty#1725
bluzername wants to merge 1 commit intofarion1231:mainfrom
bluzername:fix/empty-import-error-message

Conversation

@bluzername
Copy link
Copy Markdown

Problem

When clicking "Import Current Config" and the import fails (for example no model configuration available), the error notification popup shows with empty text. User sees the toast but has no idea what went wrong.

Screenshot from issue shows the empty error message clearly.

Root Cause

In ProviderList.tsx line 243, the onError handler does toast.error(error.message). But sometimes the Tauri invoke returns an error where error.message is empty string. The toast then renders with no visible text.

Fix

Added fallback using || operator:

toast.error(error.message || t("provider.importCurrentFailed"));

When error.message is empty, it shows the localized "Failed to import current configuration" text instead.

Also added the importCurrentFailed i18n key to all 3 locale files:

  • English: "Failed to import current configuration"
  • Chinese: "导入当前配置失败"
  • Japanese: "現在の設定のインポートに失敗しました"

Files changed

  • src/components/providers/ProviderList.tsx - added fallback in onError handler
  • src/i18n/locales/en.json - added importCurrentFailed key
  • src/i18n/locales/zh.json - added importCurrentFailed key
  • src/i18n/locales/ja.json - added importCurrentFailed key

Closes #1715

Copy link
Copy Markdown
Owner

@farion1231 farion1231 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! Could you please check whether it would be better to use the following approach?

ProviderList.tsx:243 — the project’s standard error extraction function should be used

  • toast.error(error.message || t("provider.importCurrentFailed"));
  • toast.error(extractErrorMessage(error) || t("provider.importCurrentFailed"));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

没有相应模型配置时,点击【导入当前配置】弹出的错误提示文案为空

2 participants