Refactor for global error type

This commit is contained in:
2024-07-22 18:36:48 -04:00
Unverified
parent 4bd3112816
commit cb63e7d538
9 changed files with 48 additions and 37 deletions

7
shared/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "realm_shared"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1.0.203", features = ["derive"] }

1
shared/src/lib.rs Normal file
View File

@@ -0,0 +1 @@
pub mod types;

21
shared/src/types.rs Normal file
View File

@@ -0,0 +1,21 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum ErrorCode {
Error,
Unauthorized,
EmailTaken,
UsernameTaken,
InvalidLoginCode,
InvalidImage,
InvalidUsername,
InvalidEmail,
InvalidToken,
UnableToConnectToMail,
UnableToSendMail,
MessageNotFound,
RoomNotFound,
UserNotFound,
MalformedDBResponse,
}