-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #376: fix: rework error handling for add_category
5dc0017 fix: add comments (pcarles) 5f96cce fix: update doc (pcarles) c535652 fix: rework error handling for add_category Fixes #253 (pcarles) Pull request description: Hello ! This PR fixes [#253](#253). I think that we can keep the unique constraint in the DB on top of this change as proposed by @josecelano in the original issue Following this change, I think that we should move some of the error logic that is inside the databases crate to the services one. All of these errors should not be raised at database level but rather at the service level: - `database::Error::UsernameTaken` - `database::Error::EmailTaken` - `database::Error::TagAlreadyExists` - `database::Error::TorrentAlreadyExists` - `database::Error::TorrentTitleAlreadyExists` This will permit to avoid using database error message parsing which is implementation specific and error prone (like [here](https://github.com/torrust/torrust-index/blob/41c80f359490a156e61bc5670874708f350ca75b/src/databases/sqlite.rs#L612C43-L612C43) or [here](https://github.com/torrust/torrust-index/blob/41c80f359490a156e61bc5670874708f350ca75b/src/databases/mysql.rs#L831)) I'd be happy to open another PR to rework the listed errors if you aggree with this new approach That's my first contribution here, and I am also pretty new to the Rust ecosystem so don't hesitate to tell me if anything's wrong ACKs for top commit: josecelano: ACK 5dc0017 Tree-SHA512: 6eea5cb5e29db8fb987bb8aafd31e9e1cbc8d6f1260c04b63268af8e2d1d63078c737f6a501925ef78d4ccb322549f69da5e4f434d8af30f6a5a1ff09768e029
- Loading branch information
Showing
6 changed files
with
14 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters