@smbcloud / cli / commits / b28b674

handle email already exist

Seto committed Sep 28, 2025 at 11:50 UTC b28b674b14146e912a605485484ead204a2744eb
3 files changed +8 -2
crates/cli/src/account/signup/process.rs
+1 -1
@@ -172,7 +172,7 @@ pub async fn do_signup_email(
172 ),
173 }),
174 Err(e) => {
175 - let error = anyhow!("Failed to signup: {}", e);
175 + let error = anyhow!("{}", e);
176 Err(error)
177 }
178 }
crates/smbcloud-model/src/error_codes.rs
+6
@@ -44,6 +44,8 @@ pub enum ErrorCode {
44 // Account
45 #[error("Unauthorized access.")]
46 Unauthorized = 100,
47 + #[error("Email already exists.")]
48 + EmailAlreadyExist = 1005,
49 // Projects
50 #[error("Project not found.")]
51 ProjectNotFound = 1000,
@@ -58,6 +60,7 @@ impl ErrorCode {
60 match value {
61 // Account
62 100 => ErrorCode::Unauthorized,
63 + 1005 => ErrorCode::EmailAlreadyExist,
64 // Projects
65 1000 => ErrorCode::ProjectNotFound,
66 // Generic errors
@@ -81,7 +84,10 @@ impl ErrorCode {
84 ErrorCode::NetworkError => {
85 "Network error. Please check your internet connection and try again."
86 }
87 + // Accounts
88 ErrorCode::Unauthorized => "Unauthorized access.",
89 + ErrorCode::EmailAlreadyExist => "Email already exists.",
90 +
91 ErrorCode::InputError => "Input error.",
92 ErrorCode::MissingConfig => "Missing config.",
93 ErrorCode::Cancel => "Cancelled operation.",
crates/smbcloud-model/src/signup.rs
+1 -1
@@ -1,5 +1,5 @@
1 use {
2 - crate::account::{Data, Status},
2 + crate::account::Data,
3 serde::{Deserialize, Serialize},
4 std::fmt::{Display, Formatter},
5 tsync::tsync,