Skip to content

Commit

Permalink
BUG: change error print from debug to display which will show only th…
Browse files Browse the repository at this point in the history
…e error without the backtrace. fixxes scrtlabs/discovery-docker-network#10
  • Loading branch information
OnlyDragon0403 committed May 6, 2019
1 parent 52c1bf5 commit 57f7b3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions enigma-core/app/src/networking/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ pub(crate) trait UnwrapError<T> {
fn unwrap_or_error(self) -> T;
}

impl<E: std::fmt::Debug> UnwrapError<IpcResponse> for Result<IpcResponse, E> {
impl<E: std::fmt::Display> UnwrapError<IpcResponse> for Result<IpcResponse, E> {
fn unwrap_or_error(self) -> IpcResponse {
match self {
Ok(m) => m,
Err(e) => {
error!("Unwrapped p2p Message failed: {:?}", e);
IpcResponse::Error {msg: format!("{:?}", e)}
error!("Unwrapped p2p Message failed: {}", e);
IpcResponse::Error {msg: format!("{}", e)}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions enigma-core/app/tests/ipc_identity_and_general_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn test_deploy_with_no_ptt() {
run_core(port);
let _val = erc20_deployment_without_ptt_to_addr(port, &generate_contract_address().to_hex());
let accepted_err = _val["msg"].as_str().unwrap();
assert_eq!(accepted_err, "EnclaveFailError { err: KeysError, status: SGX_SUCCESS }");
assert_eq!(accepted_err, "Error inside the Enclave = (KeysError)");
}

#[test]
Expand All @@ -53,7 +53,7 @@ fn test_compute_on_empty_address() {
let callable = "mint(bytes32,uint256)";
let (_val,_) = contract_compute(port, _address.into(), &args, callable);
let accepted_err = _val["msg"].as_str().unwrap();
assert_eq!(accepted_err, "DBErr { command: \"read\", kind: MissingKey }");
assert_eq!(accepted_err, "Error while trying to read, Because: The Key doesn\'t exist");
}

#[test]
Expand Down Expand Up @@ -96,7 +96,7 @@ fn test_deploy_same_contract_twice() {
let _deploy_first = erc20_deployment_without_ptt_to_addr(port, &address.to_hex());
let _deploy_second = erc20_deployment_without_ptt_to_addr(port, &address.to_hex());
let accepted_err = _deploy_second["msg"].as_str().unwrap();
assert_eq!(accepted_err, "DBErr { command: \"create\", kind: KeyExists }");
assert_eq!(accepted_err, "Error while trying to create, Because: The Key already exists");
}

#[test]
Expand Down

0 comments on commit 57f7b3a

Please sign in to comment.