Other changes for Tauri

This commit is contained in:
Igor Katson 2023-12-02 15:59:20 +00:00
parent 99db087cf1
commit fe04e17d63
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 16 additions and 23 deletions

View file

@ -11,6 +11,14 @@ pub struct ApiError {
}
impl ApiError {
pub fn new_from_string(status: StatusCode, text: String) -> Self {
Self {
status: Some(status),
kind: ApiErrorKind::Other(anyhow::anyhow!("{}", text)),
plaintext: false,
}
}
pub const fn torrent_not_found(torrent_id: usize) -> Self {
Self {
status: Some(StatusCode::NOT_FOUND),