add more informative "resource does not exist" errors
This commit is contained in:
parent
f4fe9abda8
commit
86f41ae0a4
@ -140,7 +140,7 @@ impl Resources {
|
|||||||
let archetype = self
|
let archetype = self
|
||||||
.resource_archetypes
|
.resource_archetypes
|
||||||
.get(&TypeId::of::<T>())
|
.get(&TypeId::of::<T>())
|
||||||
.expect("Resource does not exist");
|
.unwrap_or_else(|| panic!("Resource does not exist {}", std::any::type_name::<T>()));
|
||||||
Res::new(archetype, 0).expect("Resource does not exist")
|
Res::new(archetype, 0).expect("Resource does not exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ impl Resources {
|
|||||||
let archetype = self
|
let archetype = self
|
||||||
.resource_archetypes
|
.resource_archetypes
|
||||||
.get(&TypeId::of::<T>())
|
.get(&TypeId::of::<T>())
|
||||||
.expect("Resource does not exist");
|
.unwrap_or_else(|| panic!("Resource does not exist {}", std::any::type_name::<T>()));
|
||||||
ResMut::new(archetype, 0).expect("Resource does not exist")
|
ResMut::new(archetype, 0).expect("Resource does not exist")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user