right now im treating nearly every issue as an error when debug logging. later i can revisit this and classify severity with respect to the actual error being thrown

unstable
Penguin 2 years ago
parent a1ac14b456
commit 13c006038e

@ -0,0 +1 @@
penguin@gpenguin.2954:1640039390

@ -78,8 +78,8 @@ pub fn ia_new(igloo: &Igloo, project_name: String, initial_target: String) -> Ig
// is igloo project // is igloo project
if IglooProject::is_igloo_prj(&igloo.env.cwd) if IglooProject::is_igloo_prj(&igloo.env.cwd)
{ {
println!("Calling igloo new from inside igloo project..."); ret = IS_NEW_CALLED_IN_EXISTING_PRJ;
ret = IS_BAD; igloo_debug!(WARNING, ret);
return ret return ret
} }
@ -87,7 +87,8 @@ pub fn ia_new(igloo: &Igloo, project_name: String, initial_target: String) -> Ig
if std::path::Path::new( if std::path::Path::new(
&igloo.env.cwd.join(&project_name)).exists() &igloo.env.cwd.join(&project_name)).exists()
{ {
ret = IS_BAD; ret = IS_NEW_DIR_ALREADY_EXISTS;
igloo_debug!(WARNING, ret);
return ret return ret
} }
@ -96,15 +97,38 @@ pub fn ia_new(igloo: &Igloo, project_name: String, initial_target: String) -> Ig
Ok(v) => v, Ok(v) => v,
Err(e) => Err(e) =>
{ {
println!("{:?}", e); igloo_debug!(ERROR, e);
panic!(); return e
} }
}; };
prj.add_target_to_config(initial_target); ret = prj.add_target_to_config(initial_target);
if ret != IS_GOOD
{
igloo_debug!(ERROR, ret);
return ret
}
// Now populate // Now populate
prj.generate(); ret = prj.generate();
if ret != IS_GOOD
{
igloo_debug!(ERROR, ret);
return ret
}
ret = prj.generate_igloo_header();
if ret != IS_GOOD
{
igloo_debug!(ERROR, ret);
return ret
}
ret = prj.generate_igloo_main();
if ret != IS_GOOD
{
igloo_debug!(ERROR, ret);
}

@ -1,12 +1,11 @@
use crate::Igloo; use crate::Igloo;
use crate::igloo_cli::*; use crate::igloo_cli::*;
use crate::IglooType; use crate::IglooType::{self, *};
use crate::IglooType::*; use crate::IglooStatus::{self, *};
use crate::IglooDebugSeverity::{self, *};
use crate::IglooStatus;
use crate::IglooStatus::*;
use crate::igloo_util::*;
use crate::igloo_project; use crate::igloo_project;
use crate::igloo_target::IglooTarget; use crate::igloo_target::IglooTarget;
@ -117,6 +116,7 @@ impl<'a> IglooProject<'a>
/// This takes input from cli and generates the project in memory /// This takes input from cli and generates the project in memory
pub fn from_new(igloo_in: &'a Igloo, project_name: String) -> Result<IglooProject, IglooStatus> pub fn from_new(igloo_in: &'a Igloo, project_name: String) -> Result<IglooProject, IglooStatus>
{ {
igloo_debug!(TRACE, IS_NONE, "Creating new igloo project named {}", project_name);
let mut settings = Settings::default(); let mut settings = Settings::default();
settings.profile.name = String::from(&project_name); settings.profile.name = String::from(&project_name);
Ok(IglooProject Ok(IglooProject
@ -263,12 +263,12 @@ impl<'a> IglooProject<'a>
IS_GOOD IS_GOOD
} }
fn generate_igloo_header(&self) -> IglooStatus pub fn generate_igloo_header(&self) -> IglooStatus
{ {
IS_GOOD IS_BAD
} }
fn generate_igloo_main(&self) -> IglooStatus pub fn generate_igloo_main(&self) -> IglooStatus
{ {
IS_GOOD IS_GOOD
} }

@ -53,11 +53,13 @@ pub enum IglooDebugSeverity
#[derive(PartialEq)] #[derive(PartialEq)]
pub enum IglooStatus pub enum IglooStatus
{ {
IS_GOOD = 0x00, IS_GOOD = 0x00,
IS_BAD = 0x01, IS_BAD = 0x01,
IS_UNKNOWN = 0x02, IS_UNKNOWN = 0x02,
IS_FAILED_TO_LOAD_MTM = 0x03, IS_FAILED_TO_LOAD_MTM = 0x03,
IS_NONE = 0xFF, IS_NEW_CALLED_IN_EXISTING_PRJ = 0x04,
IS_NEW_DIR_ALREADY_EXISTS = 0x05,
IS_NONE = 0xFF,
} }
use IglooStatus::*; use IglooStatus::*;

Loading…
Cancel
Save