Skip to content

Commit ed21dd3

Browse files
authored
Merge pull request #26 from cryptlex/muneeb/free-activation-exception
feat: add free plan activation limit exception
2 parents 8efcebe + 226a190 commit ed21dd3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/error_codes.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ pub enum LexActivatorError {
151151
LA_E_USERS_LIMIT_REACHED = 103,
152152
/// OS user has changed since activation and the license is user-locked.
153153
LA_E_OS_USER = 104,
154+
/// Invalid permission flag.
155+
LA_E_INVALID_PERMISSION_FLAG = 105,
156+
/// The free plan has reached its activation limit.
157+
LA_E_FREE_PLAN_ACTIVATION_LIMIT_REACHED = 106,
154158
}
155159

156160
impl From<i32> for LexActivatorStatus {
@@ -233,6 +237,8 @@ impl From<i32> for LexActivatorError {
233237
102 => LexActivatorError::LA_E_OIDC_SSO_NOT_ENABLED,
234238
103 => LexActivatorError::LA_E_USERS_LIMIT_REACHED,
235239
104 => LexActivatorError::LA_E_OS_USER,
240+
105 => LexActivatorError::LA_E_INVALID_PERMISSION_FLAG,
241+
106 => LexActivatorError::LA_E_FREE_PLAN_ACTIVATION_LIMIT_REACHED,
236242
_ => todo!(),
237243
// Add more mappings as needed
238244
}
@@ -318,6 +324,8 @@ impl fmt::Display for LexActivatorError {
318324
LexActivatorError::LA_E_OIDC_SSO_NOT_ENABLED => write!(f, "{} OIDC SSO is not enabled.", LexActivatorError::LA_E_OIDC_SSO_NOT_ENABLED as i32),
319325
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),
320326
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),
327+
LexActivatorError::LA_E_INVALID_PERMISSION_FLAG => write!(f, "{} Invalid permission flag.", LexActivatorError::LA_E_INVALID_PERMISSION_FLAG as i32),
328+
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),
321329
}
322330
}
323331
}
@@ -339,7 +347,7 @@ impl LexActivatorCode {
339347
pub fn from_i32(code: i32) -> Self {
340348
match code {
341349
0..=32 => LexActivatorCode::Status(LexActivatorStatus::from(code)),
342-
40..=104 => LexActivatorCode::Error(LexActivatorError::from(code)),
350+
40..=106 => LexActivatorCode::Error(LexActivatorError::from(code)),
343351
_ => LexActivatorCode::Error(LexActivatorError::LA_E_CLIENT), // Fallback to a general error
344352
}
345353
}

0 commit comments

Comments
 (0)