diff --git a/src/cli/build.rs b/src/cli/build.rs index 13db6681..88760e2f 100644 --- a/src/cli/build.rs +++ b/src/cli/build.rs @@ -44,7 +44,7 @@ pub fn build(options: BuildCommand) -> Result<(), anyhow::Error> { let vfs = Vfs::new_default(); - let session = ServeSession::new(vfs, &options.absolute_project()); + let session = ServeSession::new(vfs, &options.absolute_project())?; let mut cursor = session.message_queue().cursor(); { diff --git a/src/cli/serve.rs b/src/cli/serve.rs index b4fbcd63..07ae85b3 100644 --- a/src/cli/serve.rs +++ b/src/cli/serve.rs @@ -18,7 +18,7 @@ const DEFAULT_PORT: u16 = 34872; pub fn serve(global: GlobalOptions, options: ServeCommand) -> Result<()> { let vfs = Vfs::new_default(); - let session = Arc::new(ServeSession::new(vfs, &options.absolute_project())); + let session = Arc::new(ServeSession::new(vfs, &options.absolute_project())?); let port = options .port diff --git a/src/cli/upload.rs b/src/cli/upload.rs index 2a9b7f7a..49e367d1 100644 --- a/src/cli/upload.rs +++ b/src/cli/upload.rs @@ -22,7 +22,7 @@ pub fn upload(options: UploadCommand) -> Result<(), anyhow::Error> { let vfs = Vfs::new_default(); - let session = ServeSession::new(vfs, &options.absolute_project()); + let session = ServeSession::new(vfs, &options.absolute_project())?; let tree = session.tree(); let inner_tree = tree.inner(); diff --git a/src/serve_session.rs b/src/serve_session.rs index cb0e81d7..db0935d4 100644 --- a/src/serve_session.rs +++ b/src/serve_session.rs @@ -8,6 +8,7 @@ use std::{ use crossbeam_channel::Sender; use memofs::Vfs; use rbx_dom_weak::RbxInstanceProperties; +use thiserror::Error; use crate::{ change_processor::ChangeProcessor, @@ -90,7 +91,7 @@ impl ServeSession { /// The project file is expected to be loaded out-of-band since it's /// currently loaded from the filesystem directly instead of through the /// in-memory filesystem layer. - pub fn new>(vfs: Vfs, start_path: P) -> Self { + pub fn new>(vfs: Vfs, start_path: P) -> Result { let start_path = start_path.as_ref(); let start_time = Instant::now(); @@ -152,7 +153,7 @@ impl ServeSession { tree_mutation_receiver, ); - Self { + Ok(Self { change_processor, start_time, session_id, @@ -161,7 +162,7 @@ impl ServeSession { message_queue, tree_mutation_sender, vfs, - } + }) } pub fn tree_handle(&self) -> Arc> { @@ -205,3 +206,6 @@ impl ServeSession { self.root_project.serve_place_ids.as_ref() } } + +#[derive(Debug, Error)] +pub enum ServeSessionError {}