Skip to content

Commit

Permalink
fix(macros): makes macro errors consistent with others
Browse files Browse the repository at this point in the history
Mainly this is newline fixes

Closes #118
  • Loading branch information
kbknapp committed May 15, 2015
1 parent 3c0636e commit 0c264a8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ macro_rules! value_t {
Some(v) => {
match v.parse::<$t>() {
Ok(val) => Ok(val),
Err(_) => Err(format!("{} isn't a valid {}",v,stringify!($t))),
Err(_) => Err(format!("'{}' isn't a valid value",v)),
}
},
None => Err(format!("Argument \"{}\" not found", $v))
None => Err(format!("The argument '{}' not found", $v))
}
};
($m:ident.values_of($v:expr), $t:ty) => {
Expand All @@ -159,7 +159,7 @@ macro_rules! value_t {
match pv.parse::<$t>() {
Ok(rv) => tmp.push(rv),
Err(e) => {
err = Some(format!("{} isn't a valid {}\n{}",pv,stringify!($t),e));
err = Some(format!("'{}' isn't a valid value\n\t{}",pv,e));
break
}
}
Expand All @@ -169,7 +169,7 @@ macro_rules! value_t {
None => Ok(tmp)
}
},
None => Err(format!("Argument \"{}\" not found", $v))
None => Err(format!("The argument '{}' was not found", $v))
}
};
}
Expand Down Expand Up @@ -227,18 +227,17 @@ macro_rules! value_t_or_exit {
match v.parse::<$t>() {
Ok(val) => val,
Err(e) => {
println!("{} isn't a valid {}\n\t{}\n{}\nPlease re-run with --help for \
println!("'{}' isn't a valid value\n\t{}\n\n{}\n\nPlease re-run with --help for \
more information",
v,
stringify!($t),
e,
$m.usage());
::std::process::exit(1);
}
}
},
None => {
println!("Argument \"{}\" not found or is not valid\n{}\nPlease re-run with \
println!("The argument '{}' was not found or is not valid\n\n{}\n\nPlease re-run with \
--help for more information",
$v,
$m.usage());
Expand All @@ -254,10 +253,9 @@ macro_rules! value_t_or_exit {
match pv.parse::<$t>() {
Ok(rv) => tmp.push(rv),
Err(_) => {
println!("{} isn't a valid {}\n\t{}\nPlease re-run with --help for more \
println!("'{}' isn't a valid value\n\t{}\n\nPlease re-run with --help for more \
information",
pv,
stringify!($t),
$m.usage());
::std::process::exit(1);
}
Expand All @@ -266,7 +264,7 @@ macro_rules! value_t_or_exit {
tmp
},
None => {
println!("Argument \"{}\" not found or is not valid\n{}\nPlease re-run with \
println!("The argument '{}' not found or is not valid\n\n{}\n\nPlease re-run with \
--help for more information",
$v,
$m.usage());
Expand Down

0 comments on commit 0c264a8

Please sign in to comment.