Code Monkey home page Code Monkey logo

chainerror's People

Contributors

dependabot-preview[bot] avatar haraldh avatar jduchniewicz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jduchniewicz

chainerror's Issues

tests fail with Rust 1.71+

We're packaging the chainerror crate for Fedora Linux as a dependency of varlink-cli, and run tests during the build process. I noticed that doctests have started to fail with Rust 1.71.0 - this is also reproducible by checking out this git repo and just running "cargo test --doc".

The error messages don't make much sense to me, but it looks like the line numbers in the error message are different from the expected ones with Rust 1.71:

    Finished test [unoptimized + debuginfo] target(s) in 0.00s
   Doc-tests chainerror

running 8 tests
test src/lib.rs - (line 6) ... ok
test src/lib.rs - derive_err_kind (line 745) ... ok
test src/lib.rs - ChainError<T>::find_kind_or_cause (line 233) ... ok
test src/lib.rs - ChainError<T>::find_chain_cause (line 210) ... ok
test src/lib.rs - (line 41) ... FAILED
test src/lib.rs - ChainError<T>::kind (line 262) ... ok
test src/lib.rs - derive_str_context (line 682) ... ok
test src/lib.rs - ChainError<T>::find_cause (line 160) ... ok

failures:

---- src/lib.rs - (line 41) stdout ----
Test executable failed (exit status: 101).

stderr:
Error:
src/lib.rs:17:51: read the config file
Caused by:
src/lib.rs:10:47: Reading file: "foo.txt"
Caused by:
Os { code: 2, kind: NotFound, message: "No such file or directory" }
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `"src/lib.rs:17:51: read the config file\nCaused by:\nsrc/lib.rs:10:47: Reading file: \"foo.txt\"\nCaused by:\nOs { code: 2, kind: NotFound, message: \"No such file or directory\" }\n"`,
 right: `"src/lib.rs:16:51: read the config file\nCaused by:\nsrc/lib.rs:9:47: Reading file: \"foo.txt\"\nCaused by:\nOs { code: 2, kind: NotFound, message: \"No such file or directory\" }\n"`', src/lib.rs:25:7
stack backtrace:
   0:     0x55751331f3e1 - std::backtrace_rs::backtrace::libunwind::trace::h6aeaf83abc038fe6
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55751331f3e1 - std::backtrace_rs::backtrace::trace_unsynchronized::h4f9875212db0ad97
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55751331f3e1 - std::sys_common::backtrace::_print_fmt::h3f820027e9c39d3b
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x55751331f3e1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hded4932df41373b3
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55751333b32f - core::fmt::rt::Argument::fmt::hc8ead7746b2406d6
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/fmt/rt.rs:138:9
   5:     0x55751333b32f - core::fmt::write::hb1cb56105a082ad9
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/fmt/mod.rs:1094:21
   6:     0x55751331d661 - std::io::Write::write_fmt::h797fda7085c97e57
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/io/mod.rs:1713:15
   7:     0x55751331f1f5 - std::sys_common::backtrace::_print::h492d3c92d7400346
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x55751331f1f5 - std::sys_common::backtrace::print::hf74aa2eef05af215
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x557513320577 - std::panicking::default_hook::{{closure}}::h8cad394227ea3de8
  10:     0x557513320364 - std::panicking::default_hook::h249cc184fec99a8a
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:288:9
  11:     0x557513320a2c - std::panicking::rust_panic_with_hook::h82ebcd5d5ed2fad4
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:705:13
  12:     0x557513320927 - std::panicking::begin_panic_handler::{{closure}}::h810bed8ecbe66f1a
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:597:13
  13:     0x55751331f816 - std::sys_common::backtrace::__rust_end_short_backtrace::h1410008071796261
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/sys_common/backtrace.rs:151:18
  14:     0x557513320672 - rust_begin_unwind
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:593:5
  15:     0x557513300e93 - core::panicking::panic_fmt::ha0a42a25e0cf258d
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:67:14
  16:     0x5575133010fb - core::panicking::assert_failed_inner::h8de29b2c8e31440f
  17:     0x55751330342a - core::panicking::assert_failed::h2d923ab03f7f1dd7
  18:     0x557513306a2b - rust_out::main::h5cfeb40e49780147
  19:     0x5575133025f3 - core::ops::function::FnOnce::call_once::hffc7fce7ac910f2d
  20:     0x5575133019e6 - std::sys_common::backtrace::__rust_begin_short_backtrace::hb65aab94565099a4
  21:     0x557513301f49 - std::rt::lang_start::{{closure}}::h6016435505c8a5a2
  22:     0x55751331a745 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h5ce27e764c284c0a
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/ops/function.rs:284:13
  23:     0x55751331a745 - std::panicking::try::do_call::h4c1fc390ae241991
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:500:40
  24:     0x55751331a745 - std::panicking::try::h4d36e7eaed86af72
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:464:19
  25:     0x55751331a745 - std::panic::catch_unwind::h41cfb4dd65282b1e
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panic.rs:142:14
  26:     0x55751331a745 - std::rt::lang_start_internal::{{closure}}::hfed411c1c5fdb925
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/rt.rs:148:48
  27:     0x55751331a745 - std::panicking::try::do_call::h6893f6f32a464342
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:500:40
  28:     0x55751331a745 - std::panicking::try::h52b7102f469a0567
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:464:19
  29:     0x55751331a745 - std::panic::catch_unwind::h62120054677916b5
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panic.rs:142:14
  30:     0x55751331a745 - std::rt::lang_start_internal::hd66bf6b7da144005
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/rt.rs:148:20
  31:     0x557513301f27 - std::rt::lang_start::hf20dd7c855f889aa
  32:     0x557513306a95 - main
  33:     0x7fae0f877b4a - __libc_start_call_main
  34:     0x7fae0f877c0b - __libc_start_main@@GLIBC_2.34
  35:     0x5575133014f5 - _start
  36:                0x0 - <unknown>



failures:
    src/lib.rs - (line 41)

test result: FAILED. 7 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.16s

error: doctest failed, to rerun pass `--doc`

Consumer work with STD only

This is one of the nicest crates around error handling. After using error-chain and failure and similar ones not I am thinking of just using std only. This crate is close but is there a way clients of chainerr write a wrapper such that the dependency on chainerr can be removed easily if a better helper crate comes to existence?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.