Skip to content

Commit 0c264a8

Browse files
committed
fix(macros): makes macro errors consistent with others
Mainly this is newline fixes Closes #118
1 parent 3c0636e commit 0c264a8

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/macros.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ macro_rules! value_t {
144144
Some(v) => {
145145
match v.parse::<$t>() {
146146
Ok(val) => Ok(val),
147-
Err(_) => Err(format!("{} isn't a valid {}",v,stringify!($t))),
147+
Err(_) => Err(format!("'{}' isn't a valid value",v)),
148148
}
149149
},
150-
None => Err(format!("Argument \"{}\" not found", $v))
150+
None => Err(format!("The argument '{}' not found", $v))
151151
}
152152
};
153153
($m:ident.values_of($v:expr), $t:ty) => {
@@ -159,7 +159,7 @@ macro_rules! value_t {
159159
match pv.parse::<$t>() {
160160
Ok(rv) => tmp.push(rv),
161161
Err(e) => {
162-
err = Some(format!("{} isn't a valid {}\n{}",pv,stringify!($t),e));
162+
err = Some(format!("'{}' isn't a valid value\n\t{}",pv,e));
163163
break
164164
}
165165
}
@@ -169,7 +169,7 @@ macro_rules! value_t {
169169
None => Ok(tmp)
170170
}
171171
},
172-
None => Err(format!("Argument \"{}\" not found", $v))
172+
None => Err(format!("The argument '{}' was not found", $v))
173173
}
174174
};
175175
}
@@ -227,18 +227,17 @@ macro_rules! value_t_or_exit {
227227
match v.parse::<$t>() {
228228
Ok(val) => val,
229229
Err(e) => {
230-
println!("{} isn't a valid {}\n\t{}\n{}\nPlease re-run with --help for \
230+
println!("'{}' isn't a valid value\n\t{}\n\n{}\n\nPlease re-run with --help for \
231231
more information",
232232
v,
233-
stringify!($t),
234233
e,
235234
$m.usage());
236235
::std::process::exit(1);
237236
}
238237
}
239238
},
240239
None => {
241-
println!("Argument \"{}\" not found or is not valid\n{}\nPlease re-run with \
240+
println!("The argument '{}' was not found or is not valid\n\n{}\n\nPlease re-run with \
242241
--help for more information",
243242
$v,
244243
$m.usage());
@@ -254,10 +253,9 @@ macro_rules! value_t_or_exit {
254253
match pv.parse::<$t>() {
255254
Ok(rv) => tmp.push(rv),
256255
Err(_) => {
257-
println!("{} isn't a valid {}\n\t{}\nPlease re-run with --help for more \
256+
println!("'{}' isn't a valid value\n\t{}\n\nPlease re-run with --help for more \
258257
information",
259258
pv,
260-
stringify!($t),
261259
$m.usage());
262260
::std::process::exit(1);
263261
}
@@ -266,7 +264,7 @@ macro_rules! value_t_or_exit {
266264
tmp
267265
},
268266
None => {
269-
println!("Argument \"{}\" not found or is not valid\n{}\nPlease re-run with \
267+
println!("The argument '{}' not found or is not valid\n\n{}\n\nPlease re-run with \
270268
--help for more information",
271269
$v,
272270
$m.usage());

0 commit comments

Comments
 (0)