Skip to content

feat: improve errors when entity is unavailable #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 5, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
also improve the error text
  • Loading branch information
makspll committed Apr 5, 2025
commit 0fd5088239fc5f4e40119ed08ddce6a3bba0e712
8 changes: 7 additions & 1 deletion crates/bevy_mod_scripting_core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,13 @@ macro_rules! invalid_index {

macro_rules! missing_entity {
($entity:expr) => {
format!("Missing or invalid entity: {}", $entity)
{
if ($entity.index() == 0) {
format!("Invalid entity: {}. Are you trying to use an entity in a callback in which it's unavailable?", $entity)
} else {
format!("Missing or invalid entity: {}", $entity)
}
}
};
}

Expand Down
Loading