Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add free plan activation limit exception #26

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ pub enum LexActivatorError {
LA_E_USERS_LIMIT_REACHED = 103,
/// OS user has changed since activation and the license is user-locked.
LA_E_OS_USER = 104,
/// Invalid permission flag.
LA_E_INVALID_PERMISSION_FLAG = 105,
/// The free plan has reached its activation limit.
LA_E_FREE_PLAN_ACTIVATION_LIMIT_REACHED = 106,
}

impl From<i32> for LexActivatorStatus {
Expand Down Expand Up @@ -233,6 +237,8 @@ impl From<i32> for LexActivatorError {
102 => LexActivatorError::LA_E_OIDC_SSO_NOT_ENABLED,
103 => LexActivatorError::LA_E_USERS_LIMIT_REACHED,
104 => LexActivatorError::LA_E_OS_USER,
105 => LexActivatorError::LA_E_INVALID_PERMISSION_FLAG,
106 => LexActivatorError::LA_E_FREE_PLAN_ACTIVATION_LIMIT_REACHED,
_ => todo!(),
// Add more mappings as needed
}
Expand Down Expand Up @@ -318,6 +324,8 @@ impl fmt::Display for LexActivatorError {
LexActivatorError::LA_E_OIDC_SSO_NOT_ENABLED => write!(f, "{} OIDC SSO is not enabled.", LexActivatorError::LA_E_OIDC_SSO_NOT_ENABLED as i32),
LexActivatorError::LA_E_USERS_LIMIT_REACHED => write!(f, "{} The allowed users for this account has reached its limit.", LexActivatorError::LA_E_USERS_LIMIT_REACHED as i32),
LexActivatorError::LA_E_OS_USER => write!(f, "{} OS user has changed since activation and the license is user-locked.", LexActivatorError::LA_E_OS_USER as i32),
LexActivatorError::LA_E_INVALID_PERMISSION_FLAG => write!(f, "{} Invalid permission flag.", LexActivatorError::LA_E_INVALID_PERMISSION_FLAG as i32),
LexActivatorError::LA_E_FREE_PLAN_ACTIVATION_LIMIT_REACHED => write!(f, "{} The free plan has reached its activation limit.", LexActivatorError::LA_E_FREE_PLAN_ACTIVATION_LIMIT_REACHED as i32),
}
}
}
Expand All @@ -339,7 +347,7 @@ impl LexActivatorCode {
pub fn from_i32(code: i32) -> Self {
match code {
0..=32 => LexActivatorCode::Status(LexActivatorStatus::from(code)),
40..=104 => LexActivatorCode::Error(LexActivatorError::from(code)),
40..=106 => LexActivatorCode::Error(LexActivatorError::from(code)),
_ => LexActivatorCode::Error(LexActivatorError::LA_E_CLIENT), // Fallback to a general error
}
}
Expand Down
Loading