Files
anki/ts/lib/generated
Carlos Mendez 5a58c8516f feat: improved error message for CSV import (#5484)
<!--
Title (for the Pull Request title field at the top):
Use a short prefix so the change type is obvious. You do not need to
repeat it in the body below.

Examples:
- fix: — bugfix
- feat: — feature
- refactor: — internal change without user-facing feature
- docs: — documentation only
- chore: — tooling, CI, deps, build housekeeping
- test: — tests only
-->

## Linked issue (required)

<!-- Fixes #123 / Closes #123 -->
Fixes #4346 

## Summary / motivation (required)

<!-- What this PR does and why. For larger changes, add enough context
for reviewers. -->
Improves the CSV import error experience for empty or invalid CSV files.

Previously, the import error page exposed an HTTP status code and did
not provide a clear way for the user to dismiss the error and return to
the main Anki window.

Changes:
- displays the import error without exposing the HTTP status code
- adds an "Okay" button to dismiss the error
- use Anki frontend RPC architecture to close the active import dialog
- handles CSV import loader errors with a try/catch and displays them
through the shared ErrorPage component

The solution uses the existing `ImportDialog.reject()` path so the
dialog box performs normal clean up before closing.

This implementation was inspired by the previous discussion and earlier
work in #4383. Thank you @medProgAyat and @josod827. Your discussion and
implementations were a great assest to helping me solve and implement a
solution.

## Steps to reproduce (required, use N/A if not applicable)

<!-- Steps to reproduce: how to trigger the bug in the broken state (the
"before").
 - Mainly for bugfixes;
    - For bugs: numbered steps before the fix. For non-bugs: write N/A.
 - use N/A for features, refactors, docs, chore, etc.
-->

1. open Anki and click on import button
2. select a empty csv
3. error page should open

## How to test (required)

<!--- How to test: how you verified the change (checks, unit tests,
manual steps, edge cases — the "after" or general validation). --->

### Checklist (minimum)

- [ x] I ran `./ninja check` or an equivalent relevant check locally.
- [ ] I added or updated tests when the change is non-trivial or
behavior changed.

### Details

<!-- Commands, manual steps, edge cases, and what you observed -->
Manual testing:
1. Imported an empty CSV file.
2. Confirmed the custom error page is displayed.
3. Confirmed the HTTP status code is not displayed to the user.
4. Confirmed clicking the "Okay" button closes the import dialog and
returns to the main Anki window.
5. Imported a valid CSV file and confirmed the normal CSV import flow
still works.

## Before / after behavior (optional)

<!-- For bugfixes: behavior before vs after. For other types: N/A or a
short note. -->

Before:
- Empty CSV imports display an error without a clear dismissal action.
- Development error output may include the HTTP status code.

After:
- The error is displayed through the shared error UI.
- The user can click "Okay" to close the import dialog.
- The close action is handled through a frontend RPC.

## Risk / compatibility / migration (optional)

<!-- Breaking changes, rollout notes, or N/A for small / low-risk PRs
-->

Low risk. The change is limited to CSV import error handling and the
import dialog close path.


## UI evidence (required for visual changes; otherwise N/A)

<!-- Screenshot or short video -->

before:
<img width="800" height="800" alt="image"
src="https://github.com/user-attachments/assets/4fe77689-3ebd-4a98-9bd9-4916214bbb29"
/>

after:
<img width="788" height="818" alt="image"
src="https://github.com/user-attachments/assets/8451f465-894a-4f52-a11b-459fc6840326"
/>


## Scope

- [x ] This PR is focused on one change (no unrelated edits).
2026-09-01 15:43:18 +03:00
..
2024-03-31 09:16:31 +01:00

Files in this folder get combined with generated files in out/ts/lib/generated/