mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 03:36:06 +00:00
Graceful errors instead of crashing (#1267)
This commit is contained in:
parent
7b2ff98bd9
commit
f291d90f66
17 changed files with 167 additions and 99 deletions
|
|
@ -200,7 +200,15 @@ impl JobThreadContext {
|
|||
if let Some(instance) = tree.get_instance(id) {
|
||||
if let Some(instigating_source) = &instance.metadata().instigating_source {
|
||||
match instigating_source {
|
||||
InstigatingSource::Path(path) => fs::remove_file(path).unwrap(),
|
||||
InstigatingSource::Path(path) => {
|
||||
if let Err(err) = fs::remove_file(path) {
|
||||
log::error!(
|
||||
"Failed to remove file {}: {}",
|
||||
path.display(),
|
||||
err
|
||||
);
|
||||
}
|
||||
}
|
||||
InstigatingSource::ProjectNode { .. } => {
|
||||
log::warn!(
|
||||
"Cannot remove instance {:?}, it's from a project file",
|
||||
|
|
@ -244,7 +252,13 @@ impl JobThreadContext {
|
|||
match instigating_source {
|
||||
InstigatingSource::Path(path) => {
|
||||
if let Some(Variant::String(value)) = changed_value {
|
||||
fs::write(path, value).unwrap();
|
||||
if let Err(err) = fs::write(path, value) {
|
||||
log::error!(
|
||||
"Failed to write file {}: {}",
|
||||
path.display(),
|
||||
err
|
||||
);
|
||||
}
|
||||
} else {
|
||||
log::warn!("Cannot change Source to non-string value.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue