1use hecs::Entity;
4use thiserror::*;
5
6use crate::SystemName;
7
8#[doc(hidden)]
9pub type Result<T> = std::result::Result<T, Error>;
10
11#[derive(Debug, Error)]
12pub enum Error {
16 #[error("Attempt to execute query: {query:?} on incompatible subworld: {subworld:?}")]
17 #[doc(hidden)]
18 IncompatibleSubworld {
19 subworld: &'static str,
20 query: &'static str,
21 },
22
23 #[error("Entity: {0:?} does not exist in world")]
24 #[doc(hidden)]
25 NoSuchEntity(hecs::Entity),
26 #[error("The entity {0:?} did not have the desired component {1:?}")]
27 #[doc(hidden)]
28 MissingComponent(Entity, #[source] hecs::MissingComponent),
29
30 #[error("Query for entity {0:?} did not satisfy {1:?}")]
31 #[doc(hidden)]
32 UnsatisfiedQuery(Entity, &'static str),
33
34 #[error("Context does not have data of type {0:?}")]
35 #[doc(hidden)]
36 MissingData(&'static str),
37
38 #[error("Data of type {0:?} is already mutable borrowed")]
39 #[doc(hidden)]
40 Borrow(&'static str),
41
42 #[error("Data of type {0:?} is already borrowed")]
43 #[doc(hidden)]
44 BorrowMut(&'static str),
45
46 #[error("Failed to execute system {0:#?}")]
47 #[doc(hidden)]
48 SystemError(SystemName, #[source] anyhow::Error),
49}