diff options
Diffstat (limited to 'cli/fmt.rs')
-rw-r--r-- | cli/fmt.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/cli/fmt.rs b/cli/fmt.rs index 319f7fece..b81573294 100644 --- a/cli/fmt.rs +++ b/cli/fmt.rs @@ -10,7 +10,6 @@ use crate::colors; use crate::diff::diff; use crate::fs::files_in_subtree; -use crate::op_error::OpError; use crate::text_encoding; use deno_core::ErrBox; use dprint_plugin_typescript as dprint; @@ -110,14 +109,11 @@ async fn check_source_files( if not_formatted_files_count == 0 { Ok(()) } else { - Err( - OpError::other(format!( - "Found {} not formatted {}", - not_formatted_files_count, - files_str(not_formatted_files_count), - )) - .into(), - ) + Err(ErrBox::error(format!( + "Found {} not formatted {}", + not_formatted_files_count, + files_str(not_formatted_files_count), + ))) } } @@ -175,7 +171,7 @@ async fn format_source_files( fn format_stdin(check: bool) -> Result<(), ErrBox> { let mut source = String::new(); if stdin().read_to_string(&mut source).is_err() { - return Err(OpError::other("Failed to read from stdin".to_string()).into()); + return Err(ErrBox::error("Failed to read from stdin")); } let formatter = dprint::Formatter::new(get_config()); @@ -191,7 +187,7 @@ fn format_stdin(check: bool) -> Result<(), ErrBox> { } } Err(e) => { - return Err(OpError::other(e).into()); + return Err(ErrBox::error(e)); } } Ok(()) @@ -217,7 +213,9 @@ fn is_supported(path: &Path) -> bool { } } -pub fn collect_files(files: Vec<String>) -> Result<Vec<PathBuf>, ErrBox> { +pub fn collect_files( + files: Vec<String>, +) -> Result<Vec<PathBuf>, std::io::Error> { let mut target_files: Vec<PathBuf> = vec![]; if files.is_empty() { |