Fix usage of StoreId::exists() -> raise Error if error occurs
This commit is contained in:
parent
c2838cca3b
commit
0525f998c8
1 changed files with 10 additions and 2 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use ruru::{Class, Object, AnyObject, Boolean, RString, NilClass, VerifiedObject};
|
||||
use ruru::{Class, Object, AnyObject, Boolean, RString, NilClass, VerifiedObject, VM};
|
||||
|
||||
use libimagstore::storeid::StoreId;
|
||||
use util::Unwrap;
|
||||
|
@ -116,7 +116,15 @@ methods!(
|
|||
}
|
||||
|
||||
fn r_storeid_exists() -> Boolean {
|
||||
Boolean::new(itself.get_data(&*STOREID_WRAPPER).exists())
|
||||
use std::error::Error;
|
||||
|
||||
match itself.get_data(&*STOREID_WRAPPER).exists() {
|
||||
Ok(bool) => Boolean::new(bool),
|
||||
Err(e) => {
|
||||
VM::raise(Class::from_existing("RuntimeError"), e.description());
|
||||
Boolean::new(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn r_storeid_to_str() -> AnyObject {
|
||||
|
|
Loading…
Reference in a new issue