mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 20:55:50 +00:00
Improve error messages for 'serve' command.
Rojo now throws an error if no project file could be found. Fixes #63.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Rojo Change Log
|
||||
|
||||
## Current Master
|
||||
*No changes*
|
||||
* Rojo now throws an error if no project file is found. ([#63](https://github.com/LPGhatguy/rojo/issues/63))
|
||||
|
||||
## 0.4.4 (April 7, 2018)
|
||||
* Fix small regression introduced in 0.4.3
|
||||
|
||||
@@ -14,10 +14,6 @@ use web;
|
||||
pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) {
|
||||
let server_id = rand::random::<u64>();
|
||||
|
||||
if verbose {
|
||||
println!("Attempting to locate project at {}...", project_path.display());
|
||||
}
|
||||
|
||||
let project = match Project::load(project_path) {
|
||||
Ok(v) => {
|
||||
println!("Using project from {}", project_path.display());
|
||||
@@ -26,27 +22,23 @@ pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) {
|
||||
Err(err) => {
|
||||
match err {
|
||||
ProjectLoadError::InvalidJson(serde_err) => {
|
||||
eprintln!(
|
||||
"Found invalid JSON!\nProject in: {}\nError: {}",
|
||||
project_path.display(),
|
||||
serde_err,
|
||||
);
|
||||
eprintln!("Project contained invalid JSON!");
|
||||
eprintln!("{}", project_path.display());
|
||||
eprintln!("Error: {}", serde_err);
|
||||
|
||||
process::exit(1);
|
||||
},
|
||||
ProjectLoadError::FailedToOpen | ProjectLoadError::FailedToRead => {
|
||||
eprintln!("Found project file, but failed to read it!");
|
||||
eprintln!(
|
||||
"Check the permissions of the project file at\n{}",
|
||||
project_path.display(),
|
||||
);
|
||||
eprintln!("Check the permissions of the project file at {}", project_path.display());
|
||||
|
||||
process::exit(1);
|
||||
},
|
||||
_ => {
|
||||
// Any other error is fine; use the default project.
|
||||
println!("Found no project file, using default project...");
|
||||
Project::default()
|
||||
ProjectLoadError::DidNotExist => {
|
||||
eprintln!("Found no project file! Create one using 'rojo init'");
|
||||
eprintln!("Checked for a project at {}", project_path.display());
|
||||
|
||||
process::exit(1);
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user