Handle dynamic program dlopen failures gracefully

This commit is contained in:
Michael Vines
2018-10-13 10:37:37 -07:00
parent 3828eda507
commit 2d0f07091d
3 changed files with 15 additions and 8 deletions

View File

@@ -102,7 +102,13 @@ impl SystemProgram {
}
SystemProgram::Load { program_id, name } => {
let mut hashmap = loaded_programs.write().unwrap();
hashmap.insert(program_id, DynamicProgram::new_native(name));
hashmap.insert(
program_id,
DynamicProgram::new_native(name).map_err(|err| {
warn!("SystemProgram::Load failure: {:?}", err);
Error::InvalidArgument
})?,
);
}
}
Ok(())