more optimize

This commit is contained in:
vms 2019-08-18 18:19:35 +02:00
parent b2fdcd889e
commit 3b1d45a4d7
2 changed files with 14 additions and 22 deletions

View File

@ -5,15 +5,11 @@ pub fn query(bytes: &str) -> AppResult<String> {
let response = sqlite::call(bytes.as_bytes()); let response = sqlite::call(bytes.as_bytes());
// Decode query result to a utf8 string // Decode query result to a utf8 string
match String::from_utf8(response) { String::from_utf8(response).map_err(|e| {
Ok(string) => Ok(string), log::error!("unable to decode result from bytes: {:#x?}", bytes);
Err(err) => { err_msg(&format!(
log::error!("unable to decode result from bytes: {:#x?}", bytes); "unable to decode result from bytes {:#x?}: {}",
Err(err_msg(&format!( bytes, e
"unable to decode result from bytes {:#x?}: {}", ))
bytes, err })
)))
}
}
} }

View File

@ -5,15 +5,11 @@ pub fn query(bytes: &str) -> AppResult<String> {
let response = sqlite::call(bytes.as_bytes()); let response = sqlite::call(bytes.as_bytes());
// Decode query result to a utf8 string // Decode query result to a utf8 string
match String::from_utf8(response) { String::from_utf8(response).map_err(|e| {
Ok(string) => Ok(string), log::error!("unable to decode result from bytes: {:#x?}", bytes);
Err(err) => { err_msg(&format!(
log::error!("unable to decode result from bytes: {:#x?}", bytes); "unable to decode result from bytes {:#x?}: {}",
Err(err_msg(&format!( bytes, e
"unable to decode result from bytes {:#x?}: {}", ))
bytes, err })
)))
}
}
} }