aboutsummaryrefslogtreecommitdiff
path: root/src/error
diff options
context:
space:
mode:
authorTolmachev Igor <me@igorek.dev>2025-09-25 01:20:24 +0300
committerTolmachev Igor <me@igorek.dev>2025-09-25 01:20:24 +0300
commit15c744e995805a30700cb04c488cddbb3015316b (patch)
tree4f53cff607933cea64c60a59163113893b8e5362 /src/error
parent5c63c56ba7104fe6b1d6d2fb520098019bb9b7fc (diff)
downloadqueue_server-15c744e995805a30700cb04c488cddbb3015316b.tar.gz
queue_server-15c744e995805a30700cb04c488cddbb3015316b.zip
Add basic queue CRUD
Diffstat (limited to 'src/error')
-rw-r--r--src/error/client.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/error/client.rs b/src/error/client.rs
index 980e3d2..70b6001 100644
--- a/src/error/client.rs
+++ b/src/error/client.rs
@@ -4,6 +4,8 @@ pub enum ClientError {
4 UserAlreadyExists { username: String }, 4 UserAlreadyExists { username: String },
5 InvalidPassword, 5 InvalidPassword,
6 NotAuthorized, 6 NotAuthorized,
7 UserNotFound { id: i64 },
8 QueueNotFound { id: i64 },
7} 9}
8 10
9impl ClientError { 11impl ClientError {
@@ -14,6 +16,8 @@ impl ClientError {
14 Self::UserAlreadyExists { .. } => "UserAlreadyExists", 16 Self::UserAlreadyExists { .. } => "UserAlreadyExists",
15 Self::InvalidPassword => "InvalidPassword", 17 Self::InvalidPassword => "InvalidPassword",
16 Self::NotAuthorized => "NotAuthorized", 18 Self::NotAuthorized => "NotAuthorized",
19 Self::UserNotFound { .. } => "UserNotFound",
20 Self::QueueNotFound { .. } => "QueueNotFound",
17 } 21 }
18 .to_string() 22 .to_string()
19 } 23 }
@@ -25,9 +29,11 @@ impl ClientError {
25 Self::UserAlreadyExists { username } => { 29 Self::UserAlreadyExists { username } => {
26 format!("user with username `{}` already exists", username) 30 format!("user with username `{}` already exists", username)
27 } 31 }
28 Self::InvalidPassword => "password is invalid".to_string(), 32 Self::InvalidPassword => format!("password is invalid"),
29 33
30 Self::NotAuthorized => "user is not authorized".to_string(), 34 Self::NotAuthorized => format!("user is not authorized"),
35 Self::UserNotFound { id } => format!("user with id `{}` not found", id),
36 Self::QueueNotFound { id } => format!("queue with id `{}` not found", id),
31 } 37 }
32 } 38 }
33} 39}