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 3 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
if IglooProject::is_igloo_prj(&igloo.env.cwd)
{
println!("Calling igloo new from inside igloo project...");
ret = IS_BAD;
ret = IS_NEW_CALLED_IN_EXISTING_PRJ;
igloo_debug!(WARNING, 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(
&igloo.env.cwd.join(&project_name)).exists()
{
ret = IS_BAD;
ret = IS_NEW_DIR_ALREADY_EXISTS;
igloo_debug!(WARNING, ret);
return ret
}
@ -96,15 +97,38 @@ pub fn ia_new(igloo: &Igloo, project_name: String, initial_target: String) -> Ig
Ok(v) => v,
Err(e) =>
{
println!("{:?}", e);
panic!();
igloo_debug!(ERROR, e);
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
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_cli::*;
use crate::IglooType;
use crate::IglooType::*;
use crate::IglooStatus;
use crate::IglooStatus::*;
use crate::IglooType::{self, *};
use crate::IglooStatus::{self, *};
use crate::IglooDebugSeverity::{self, *};
use crate::igloo_util::*;
use crate::igloo_project;
use crate::igloo_target::IglooTarget;
@ -117,6 +116,7 @@ impl<'a> IglooProject<'a>
/// 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>
{
igloo_debug!(TRACE, IS_NONE, "Creating new igloo project named {}", project_name);
let mut settings = Settings::default();
settings.profile.name = String::from(&project_name);
Ok(IglooProject
@ -263,12 +263,12 @@ impl<'a> IglooProject<'a>
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
}

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

Loading…
Cancel
Save