Skip to content

Commit f70b5c9

Browse files
committed
feature: Report error but not for missing script.
1 parent 2d83d1e commit f70b5c9

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

crates/bevy_mod_scripting_core/src/commands.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,17 @@ impl<P: IntoScriptPluginParams> Command for CreateOrUpdateScript<P> {
233233
reload_state = Some(state);
234234
}
235235
Err(err) => {
236-
handle_script_errors(
237-
guard.clone(),
238-
vec![err
239-
.with_script(self.id.clone())
240-
.with_context(P::LANGUAGE)
241-
.with_context("saving reload state")]
242-
.into_iter(),
243-
);
236+
let missing_script = err.downcast_interop_inner().map(|e| matches!(e, crate::error::InteropErrorInner::MissingScript { .. })).unwrap_or(false);
237+
if !missing_script {
238+
handle_script_errors(
239+
guard.clone(),
240+
vec![err
241+
.with_script(self.id.clone())
242+
.with_context(P::LANGUAGE)
243+
.with_context("saving reload state")]
244+
.into_iter(),
245+
);
246+
}
244247
}
245248
}
246249
bevy::log::debug!("{}: loading script with id: {}", P::LANGUAGE, self.id);

0 commit comments

Comments
 (0)