Skip to content

Commit 9345c3b

Browse files
committed
Panic loudly if local modules can't be loaded
1 parent f00738c commit 9345c3b

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

crates/ark/src/modules.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,14 @@ pub fn initialize() -> anyhow::Result<RObject> {
125125
&root.join("positron"),
126126
RModuleSource::Positron,
127127
namespace.sexp,
128-
)?;
128+
)
129+
.unwrap();
129130
import_directory(
130131
&root.join("rstudio"),
131132
debug::RModuleSource::RStudio,
132133
namespace.sexp,
133-
)?;
134+
)
135+
.unwrap();
134136

135137
// Spawn the watcher thread when R is idle so we don't try to access
136138
// the R API while R is starting up
@@ -271,15 +273,8 @@ mod debug {
271273

272274
// Collect and sort entries alphabetically to match RustEmbed iteration order.
273275
// https://github.com/posit-dev/positron/issues/11591#issuecomment-3816838107
274-
let mut entries: Vec<_> = std::fs::read_dir(directory)?
275-
.filter_map(|entry| match entry {
276-
Ok(entry) => Some(entry),
277-
Err(err) => {
278-
log::error!("Can't read directory entry: {err:?}");
279-
None
280-
},
281-
})
282-
.collect();
276+
let mut entries: Vec<_> =
277+
std::fs::read_dir(directory)?.collect::<std::io::Result<Vec<_>>>()?;
283278
entries.sort_by_key(|entry| entry.path());
284279

285280
for entry in entries {

0 commit comments

Comments
 (0)