Skip to content

Commit 8bbb1bd

Browse files
committed
fix: handle invalid paths to bundle command
1 parent c659974 commit 8bbb1bd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crates/cli/src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
mod logger;
22

3-
use anyhow::{anyhow, Error};
3+
use anyhow::{anyhow, bail, Error};
44
use base::commands::start_server;
55
use base::server::WorkerEntrypoints;
66
use clap::builder::FalseyValueParser;
@@ -136,8 +136,13 @@ fn main() -> Result<(), anyhow::Error> {
136136
.unwrap();
137137

138138
let path = PathBuf::from(entry_point_path.as_str());
139+
if !path.exists() {
140+
bail!("entrypoint path does not exist ({})", path.display());
141+
}
142+
139143
let mut emitter_factory = EmitterFactory::new();
140-
let maybe_import_map = load_import_map(import_map_path.clone())?;
144+
let maybe_import_map = load_import_map(import_map_path.clone())
145+
.map_err(|e| anyhow!("import map path is invalid ({})", e))?;
141146
let mut maybe_import_map_url = None;
142147
if maybe_import_map.is_some() {
143148
let abs_import_map_path =

0 commit comments

Comments
 (0)