Suppress std::io::NotFound errors

This commit is contained in:
Michael Pfaff 2022-08-16 14:31:44 -04:00
parent 2aaa043bd2
commit b1ef65e2a9
Signed by: michael
GPG Key ID: CF402C4A012AA9D4
1 changed files with 22 additions and 4 deletions

View File

@ -36,10 +36,28 @@ pub extern "system" fn Java_com_discord_rpc_DiscordRPC_connect(
match jni_connect(env, obj, client_id) {
Ok(_) => true,
Err(e) => {
error!(
concat!("at ", file!(), ":", line!(), ":", column!(), ": {}"),
e
);
match e.downcast::<std::io::Error>() {
Ok(e) => {
if e.kind() == std::io::ErrorKind::NotFound {
debug!(
concat!("at ", file!(), ":", line!(), ":", column!(), ": {}"),
e
);
return false;
} else {
error!(
concat!("at ", file!(), ":", line!(), ":", column!(), ": {}"),
e
);
}
}
Err(e) => {
error!(
concat!("at ", file!(), ":", line!(), ":", column!(), ": {}"),
e
);
}
}
false
}
}