When you upload a torrent, you can get an error because there is already another torrent with the same canonical info-hash. The error doesn't give you the pre-existing torrent infohash.
The error:
#[display(fmt = "A torrent with the same canonical infohash already exists in our database.")]
CanonicalInfoHashAlreadyExists,
should give you the info-hash, so the user can search/navigate to see the pre-existing torrent.
We can do it like we do for other error enums with the thiserror crate.
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ServiceError {
#[error("internal server error: {0}")]
InternalServerError(String),
// other variants...
}
Parent: https://github.com/torrust/torrust-index/issues/521
When you upload a torrent, you can get an error because there is already another torrent with the same canonical info-hash. The error doesn't give you the pre-existing torrent infohash.
The error:
should give you the info-hash, so the user can search/navigate to see the pre-existing torrent.
We can do it like we do for other error enums with the
thiserror
crate.