mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
🐛️ Handle unimported modules properly
helpful error, not panic! Closes #2422
This commit is contained in:
parent
b5b26eabc9
commit
4d10c22442
7 changed files with 93 additions and 32 deletions
|
@ -124,12 +124,17 @@ impl<'a> Env<'a> {
|
|||
})
|
||||
}
|
||||
},
|
||||
None => {
|
||||
panic!(
|
||||
"Module {} exists, but is not recorded in dep_idents",
|
||||
module_name
|
||||
)
|
||||
}
|
||||
None => Err(RuntimeError::ModuleNotImported {
|
||||
module_name,
|
||||
imported_modules: self
|
||||
.dep_idents
|
||||
.keys()
|
||||
.filter_map(|module_id| self.module_ids.get_name(*module_id))
|
||||
.map(|module_name| module_name.as_ref().into())
|
||||
.collect(),
|
||||
region,
|
||||
module_exists: true,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +146,7 @@ impl<'a> Env<'a> {
|
|||
.map(|string| string.as_ref().into())
|
||||
.collect(),
|
||||
region,
|
||||
module_exists: false,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue