-
Notifications
You must be signed in to change notification settings - Fork 19
Pick one: Error location or error context #30
Comments
Oh, great to see you using assert_cli! :) What does |
Dependencies that were held back: - assert_cli: See assert-rs/assert_cli#30 and assert-rs/assert_cli#31 - rss: Seems they turned off XML escaping. Didn't have time to research this.
Upgrade notes: - notify: Debouncing was added but have not yet switched to it because of the extra work to extract the relevant path Dependencies that were held back: - assert_cli: See assert-rs/assert_cli#30 and assert-rs/assert_cli#31 - rss: Seems they turned off XML escaping. Didn't have time to research this.
Looks like RUST_BACKTRACE doesn't help When I do unwrap:
Just in case, I verified that I correctly set RUST_BACKTRACE
|
Interesting. Just for comparison, for extern crate assert_cli;
use assert_cli::Assert;
fn main() {
Assert::command(&["echo", "goo"]).fails().unwrap();
} I get
I agree this is not a good backtrace, but it at least contains the relevant call site (7). But: If you change the code to: extern crate assert_cli;
use assert_cli::Assert;
fn main() {
Assert::command(&["echo", "goo"]).fails().execute().unwrap();
} you get (at least on macOS) a pretty detailed output (as Debug impl from error-chain seem to be much better than my simple
From what I understand of the error-chain code, it only collects its internal backtrace when RUST_BACKTRACE is set. Now I'm wondering: Do you think it'd be a good idea to replace my |
@killercup You could try pub fn unwrap(self) {
self.execute().unwrap();
} instead of pub fn unwrap(self) {
if let Err(err) = self.execute() {
panic!("{}", err);
}
} It's also shorter :-) |
Yeah, that's what I meant at the end, @colin-kiegel. I'm wondering if we may be able to inspect the backtrace to give a slightly more helpful error message, though. |
Ok, perhaps give |
Trying this out with the latest version with
with
and |
So I'll admit, I'm a little confused about my own issue. Not sure how much of it is confusion at the time, my confusing myself, or changes in assert_cli.
The crux of the issue seems to be my preferring macro-based solutions because the non-traceback message gives a lot of information. But then I claim traceback didn't help
and I have no clue why. As a consumer of the crate, its macro solutions are really nice but not required. I'm going to close this. |
In updating cobalt.rs to 0.4, I found that with the new API, I could either do
.unwrap()
which shows why it fails but shows the error location as withinassert_cli
(setting traceback would probably help) or to.execute(); assert!(result.is_ok());
which will get me the error location but lose the information on why it failed.See https://github.com/cobalt-org/cobalt.rs/blob/master/tests/cli.rs
The text was updated successfully, but these errors were encountered: