diff --git a/.vscode/settings.json b/.vscode/settings.json
index b6cac696..cb852cc0 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -15,6 +15,7 @@
"crossterm",
"dialoguer",
"flate",
+ "fmtln",
"hasher",
"indicatif",
"outpath",
diff --git a/crates/snm_download_builder/src/lib.rs b/crates/snm_download_builder/src/lib.rs
index 30ed445a..8758686c 100644
--- a/crates/snm_download_builder/src/lib.rs
+++ b/crates/snm_download_builder/src/lib.rs
@@ -1,7 +1,7 @@
use colored::*;
use futures_util::StreamExt;
use indicatif::{ProgressBar, ProgressDrawTarget};
-use reqwest::{Client, StatusCode};
+use reqwest::Client;
use snm_utils::snm_error::SnmError;
use std::path::Path;
use std::time::Duration;
@@ -50,12 +50,6 @@ impl DownloadBuilder {
download_url: &str,
abs_path: P,
) -> Result
{
- // let response = Client::new().head(download_url).send().await?;
-
- // if response.status() == StatusCode::NOT_FOUND {
- // return Err(SnmError::NotFoundResourceError(download_url.to_string()));
- // }
-
let mut attempts = 0;
while attempts < (self.retries + 1) {
@@ -91,7 +85,9 @@ impl DownloadBuilder {
if abs_path_ref.exists() {
match self.write_strategy {
WriteStrategy::Error => {
- return Err(SnmError::FileAlreadyExists(abs_path_ref.to_path_buf()));
+ return Err(SnmError::FileAlreadyExists {
+ file_path: abs_path_ref.to_path_buf(),
+ });
}
WriteStrategy::WriteAfterDelete => {
std::fs::remove_file(&abs_path_ref)?;
@@ -113,10 +109,6 @@ impl DownloadBuilder {
.send()
.await?;
- if response.status() == StatusCode::NOT_FOUND {
- return Err(SnmError::NotFoundResourceError(download_url.to_string()));
- }
-
if !response.status().is_success() {
return Err(SnmError::HttpStatusCodeUnOk);
}
diff --git a/crates/snm_package_json/src/package_json.rs b/crates/snm_package_json/src/package_json.rs
index 974721d3..68e0c015 100644
--- a/crates/snm_package_json/src/package_json.rs
+++ b/crates/snm_package_json/src/package_json.rs
@@ -2,7 +2,7 @@ use std::{collections::HashMap, fs::File, io::BufReader, ops::Not, path::PathBuf
use regex::{Match, Regex};
use serde::Deserialize;
-use snm_utils::snm_error::SnmError;
+use snm_utils::{constant::PACKAGE_MANAGER, snm_error::SnmError};
use crate::{
package_manager_meta::{PackageManager, PackageManagerDownloadHash},
@@ -107,13 +107,11 @@ fn parse_package_manager(raw_package_manager: &str) -> Result