message: Replace CommonError with WalletQueryError
diff: use utils::crypto::chacha20poly1305_ietf::ChaCha20Poly1305IETF;
  -use errors::common::CommonError;
  use errors::wallet::WalletQueryError;
  use super::wallet::Keys;
  @@ -10,12 +9,11 @@ use super::language::{Operator,TargetValue,TagName};
  // WQL query is provided as top-level Operator
  // Recursively transforms operators using encrypt_operator function
  pub(super) fn encrypt_query(operator: Operator, keys: &Keys) -> Result<Operator, WalletQueryError> {
  - let encrypted_op = operator.transform_result(&|op: Operator| -> Result<Operator, CommonError> {encrypt_operator(op, keys)})?;
  - Ok(encrypted_op)
  + operator.transform_result(&|op: Operator| -> Result<Operator, WalletQueryError> {encrypt_operator(op, keys)})
  }
  -fn encrypt_operator(op: Operator, keys: &Keys) -> Result<Operator, CommonError> {
  +fn encrypt_operator(op: Operator, keys: &Keys) -> Result<Operator, WalletQueryError> {
  match op {
  Operator::Eq(name, value) => {
  let (encrypted_name, encrypted_value) = encrypt_name_value(&name, value, keys)?;
  @@ -75,7 +73,7 @@ fn encrypt_operator(op: Operator, keys: &Keys) -> Result<Operator, CommonError>
  // Encrypts a single tag name, tag value pair.
  // If the tag name is EncryptedTagName enum variant, encrypts both the tag name and the tag value
  // If the tag name is PlainTagName enum variant, encrypts only the tag name
  -fn encrypt_name_value(name: &TagName, value: TargetValue, keys: &Keys) -> Result<(TagName, TargetValue), CommonError> {
  +fn encrypt_name_value(name: &TagName, value: TargetValue, keys: &Keys) -> Result<(TagName, TargetValue), WalletQueryError> {
  match (name, value) {
  (&TagName::EncryptedTagName(ref name), TargetValue::Unencrypted(ref s)) => {
  let encrypted_tag_name = ChaCha20Poly1305IETF::encrypt_as_searchable(&name[..], &keys.tag_name_key, &keys.tags_hmac_key);
  @@ -86,6 +84,6 @@ fn encrypt_name_value(name: &TagName, value: TargetValue, keys: &Keys) -> Result
  let encrypted_tag_name = ChaCha20Poly1305IETF::encrypt_as_searchable(&name[..], &keys.tag_name_key, &keys.tags_hmac_key);
  Ok((TagName::PlainTagName(encrypted_tag_name), TargetValue::Unencrypted(s.clone())))
  },
  - _ => Err(CommonError::InvalidState("Reached invalid combination of tag name and value while encrypting query".to_string()))
  + _ => Err(WalletQueryError::StructureErr("Reached invalid combination of tag name and value while encrypting query".to_string()))
  }
  }
  \ No newline at end of file
  