diff options
author | Pascal Hertleif <[email protected]> | 2019-11-13 19:51:57 +0000 |
---|---|---|
committer | Pascal Hertleif <[email protected]> | 2019-11-13 19:51:57 +0000 |
commit | 5075c77957e127be51e1b5271567f906abeb50c6 (patch) | |
tree | c8e8d8f29011ad2b2472a201561f3f3dc1627d8f /Cargo.lock | |
parent | 5e3c1c2b5f63e57f98a7d02f75a559d225341b1c (diff) |
Use anyhow::Result in xtask, add contexts
This builds on #2231 but was actually done before that. You see, the
cause for #2231 was that I got this error message:
Error: Error { kind: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" }) }
Just switching to `anyhow::Result` got me stack traces (when setting
`RUST_LIB_BACKTRACE=1`) that at least showed
stack backtrace:
0: std::backtrace::Backtrace::create
1: std::backtrace::Backtrace::capture
2: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
3: xtask::install_server
4: xtask::install
5: xtask::main
6: std::rt::lang_start::{{closure}}
7: std::panicking::try::do_call
8: __rust_maybe_catch_panic
9: std::rt::lang_start_internal
10: std::rt::lang_start
11: main
With the added contexts (not at all exhaustive), the error became
Error: install server
Caused by:
0: build AutoCfg with target directory
1: No such file or directory (os error 2)
Since anyhow is such a small thing (no new transitive dependencies!),
and in general gives you `Result<T, Box<dyn Error>>` on steroids, I
think this a nice small change. The only slightly annoying thing was to
replace all the `Err(format!(…))?` calls (haven't even looked at whether
we can make it support wrapping strings though), but the `bail!` macro
is shorter anyway :)
Diffstat (limited to 'Cargo.lock')
-rw-r--r-- | Cargo.lock | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock index 97452951c..c9ab3ef10 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -9,6 +9,11 @@ dependencies = [ | |||
9 | ] | 9 | ] |
10 | 10 | ||
11 | [[package]] | 11 | [[package]] |
12 | name = "anyhow" | ||
13 | version = "1.0.19" | ||
14 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
15 | |||
16 | [[package]] | ||
12 | name = "arrayvec" | 17 | name = "arrayvec" |
13 | version = "0.5.1" | 18 | version = "0.5.1" |
14 | source = "registry+https://github.com/rust-lang/crates.io-index" | 19 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1823,6 +1828,7 @@ dependencies = [ | |||
1823 | name = "xtask" | 1828 | name = "xtask" |
1824 | version = "0.1.0" | 1829 | version = "0.1.0" |
1825 | dependencies = [ | 1830 | dependencies = [ |
1831 | "anyhow 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1826 | "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | 1832 | "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", |
1827 | "pico-args 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | 1833 | "pico-args 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", |
1828 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", | 1834 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1847,6 +1853,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1847 | 1853 | ||
1848 | [metadata] | 1854 | [metadata] |
1849 | "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" | 1855 | "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" |
1856 | "checksum anyhow 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "57114fc2a6cc374bce195d3482057c846e706d252ff3604363449695684d7a0d" | ||
1850 | "checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" | 1857 | "checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" |
1851 | "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" | 1858 | "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" |
1852 | "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" | 1859 | "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" |