Don't crash when a new series name already exists or is empty (#2) #31

Merged
eric merged 1 commit from eric/fix-2-series-create-crash into master 2026-10-12 17:31:22 -05:00
Owner
  • Typing the name of a series that already exists now assigns the episode to that series instead of crashing on the UNIQUE constraint. It goes through assign_series, so re-picking the episode's current series keeps its season and episode number.
  • The name is trimmed, and an empty name shows "Series name can't be empty" in the status bar and stays on the input.
  • Any database error shows in the status bar instead of panicking.

New test: tests/series_create_tests.rs (its own file because the DB connection is a process-wide OnceLock, so each test file gets one database).

Closes #2

🤖 Generated with Claude Code

- Typing the name of a series that already exists now assigns the episode to that series instead of crashing on the UNIQUE constraint. It goes through `assign_series`, so re-picking the episode's current series keeps its season and episode number. - The name is trimmed, and an empty name shows "Series name can't be empty" in the status bar and stays on the input. - Any database error shows in the status bar instead of panicking. New test: `tests/series_create_tests.rs` (its own file because the DB connection is a process-wide `OnceLock`, so each test file gets one database). Closes #2 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Creating a series with a name that already existed hit the UNIQUE
constraint and the handler's .expect() crashed the app; an empty name
created a series called "".

create_series_and_assign now reuses the series with that name if there
is one (and goes through assign_series, so re-assigning the same series
keeps the season and episode number). The handler trims the name, refuses
an empty one, and shows a database error in the status bar instead of
panicking.

Closes #2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eric merged commit db56733dc4 into master 2026-10-12 17:31:22 -05:00
Sign in to join this conversation.
No reviewers
No labels
bug
chore
feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
spinach-dev/movies!31
No description provided.