-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: rework error handling for add_category #376
fix: rework error handling for add_category #376
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #376 +/- ##
===========================================
- Coverage 42.34% 42.05% -0.29%
===========================================
Files 79 79
Lines 4822 4829 +7
===========================================
- Hits 2042 2031 -11
- Misses 2780 2798 +18
... and 2 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
d8ed124
to
5dc0017
Compare
Force pushed to add signed commit |
ACK 5dc0017 |
Hi @pcarles, thank you very much for your contribution. It looks good to me! I think this a very good refactor to decouple the domain from the database, and It will make it easier to implement new database drivers like PostgreSQL in the future. |
Hello @josecelano What is the preferred workflow here? Should I open an issue before the PR, or just pushing a PR explaining the changes is enough |
We have a preference for opening new issues. You can get feedback even before starting working on the PR. Otherwise, we do not know you are working on it. In fact, in this case, if you are planning to open more than one issue/PR I would suggest opening a parent issue like this to track the state of the whole refactor. In general these are my "good practices" (not the repo or org rules):
In fact, this is something I want to discuss in our next meeting. |
Hello !
This PR fixes #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 or here)
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