Skip to content

Commit

Permalink
Fix compile errors, fix failing test
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Stas <[email protected]>
  • Loading branch information
Patrik-Stas committed Dec 21, 2022
1 parent ef9f62d commit 3d2ab04
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion libvcx/src/api_lib/api_handle/credential_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ pub fn to_string(handle: u32) -> LibvcxResult<String> {
}

pub fn from_string(data: &str) -> LibvcxResult<u32> {
let cred_def: CredentialDef = CredentialDef::from_string(data)?;
let cred_def: CredentialDef = CredentialDef::from_string(data)
.or_else(|e| Err(ErrorLibvcx::from_msg(ErrorKindLibvcx::CreateCredDef, e.to_string())))?;
CREDENTIALDEF_MAP.add(cred_def)
}

Expand Down
2 changes: 1 addition & 1 deletion libvcx/src/api_lib/utils/ccallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ macro_rules! check_useful_c_callback {
let $x = match $x {
Some($x) => $x,
None => {
let err = LibvcxError::from_msg($e, "Invalid callback has been passed");
let err = ErrorLibvcx::from_msg($e, "Invalid callback has been passed");
set_current_error_vcx(&err);
return err.into();
}
Expand Down
10 changes: 5 additions & 5 deletions libvcx/src/api_lib/utils/cstring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ macro_rules! check_useful_c_str {
let $x = match CStringUtils::c_str_to_string($x) {
Ok(Some(val)) => val,
_ => {
let err = LibvcxError::from_msg($e, "Invalid pointer has been passed");
let err = ErrorLibvcx::from_msg($e, "Invalid pointer has been passed");
set_current_error_vcx(&err);
return err.into();
}
};

if $x.is_empty() {
let err = LibvcxError::from_msg($e, "Empty string has been passed");
let err = ErrorLibvcx::from_msg($e, "Empty string has been passed");
set_current_error_vcx(&err);
return err.into();
}
Expand All @@ -60,7 +60,7 @@ macro_rules! check_useful_opt_c_str {
let $x = match CStringUtils::c_str_to_string($x) {
Ok(opt_val) => opt_val,
Err(_) => {
let err = LibvcxError::from_msg($e, "Invalid pointer has been passed");
let err = ErrorLibvcx::from_msg($e, "Invalid pointer has been passed");
set_current_error_vcx(&err);
return err.into();
}
Expand All @@ -71,12 +71,12 @@ macro_rules! check_useful_opt_c_str {
macro_rules! check_useful_c_byte_array {
($ptr:ident, $len:expr, $err1:expr, $err2:expr) => {
if $ptr.is_null() {
let err = LibvcxError::from_msg($err1, "Invalid pointer has been passed");
let err = ErrorLibvcx::from_msg($err1, "Invalid pointer has been passed");
set_current_error_vcx(&err);
return err.into();
}
if $len <= 0 {
let err = LibvcxError::from_msg($err2, "Array length must be greater than 0");
let err = ErrorLibvcx::from_msg($err2, "Array length must be greater than 0");
set_current_error_vcx(&err);
return err.into();
}
Expand Down

0 comments on commit 3d2ab04

Please sign in to comment.