mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-10-02 07:21:36 +00:00
parent
1ea7c204e6
commit
54933ea76d
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -64,7 +64,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.39
|
toolchain: 1.42
|
||||||
override: true
|
override: true
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
/target
|
/target
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
/.pijul/
|
||||||
|
@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased] - ReleaseDate
|
## [Unreleased] - ReleaseDate
|
||||||
|
|
||||||
|
## [0.6.5] - 2021-01-05
|
||||||
|
### Added
|
||||||
|
- add optional support for converting into `pyo3` exceptions
|
||||||
|
|
||||||
## [0.6.4] - 2021-01-04
|
## [0.6.4] - 2021-01-04
|
||||||
### Fixed
|
### Fixed
|
||||||
- added missing track_caller annotations to `wrap_err` related trait methods
|
- added missing track_caller annotations to `wrap_err` related trait methods
|
||||||
@ -26,7 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
|
|
||||||
<!-- next-url -->
|
<!-- next-url -->
|
||||||
[Unreleased]: https://github.com/yaahc/eyre/compare/v0.6.4...HEAD
|
[Unreleased]: https://github.com/yaahc/eyre/compare/v0.6.5...HEAD
|
||||||
|
[0.6.5]: https://github.com/yaahc/eyre/compare/v0.6.4...v0.6.5
|
||||||
[0.6.4]: https://github.com/yaahc/eyre/compare/v0.6.3...v0.6.4
|
[0.6.4]: https://github.com/yaahc/eyre/compare/v0.6.3...v0.6.4
|
||||||
[0.6.3]: https://github.com/yaahc/eyre/compare/v0.6.2...v0.6.3
|
[0.6.3]: https://github.com/yaahc/eyre/compare/v0.6.2...v0.6.3
|
||||||
[0.6.2]: https://github.com/yaahc/eyre/compare/v0.6.1...v0.6.2
|
[0.6.2]: https://github.com/yaahc/eyre/compare/v0.6.1...v0.6.2
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "eyre"
|
name = "eyre"
|
||||||
version = "0.6.4"
|
version = "0.6.5"
|
||||||
authors = ["David Tolnay <dtolnay@gmail.com>", "Jane Lusby <jlusby42@gmail.com>"]
|
authors = ["David Tolnay <dtolnay@gmail.com>", "Jane Lusby <jlusby42@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
@ -21,6 +21,8 @@ thiserror = "1.0"
|
|||||||
trybuild = { version = "1.0.19", features = ["diff"] }
|
trybuild = { version = "1.0.19", features = ["diff"] }
|
||||||
backtrace = "0.3.46"
|
backtrace = "0.3.46"
|
||||||
anyhow = "1.0.28"
|
anyhow = "1.0.28"
|
||||||
|
syn = { version = "1.0", features = ["full"] }
|
||||||
|
pyo3 = { version = "0.13", default-features = false, features = ["auto-initialize"] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
indenter = "0.3.0"
|
indenter = "0.3.0"
|
||||||
|
@ -62,7 +62,7 @@ impl EyreHandler for Handler {
|
|||||||
return fmt::Debug::fmt(error, f);
|
return fmt::Debug::fmt(error, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
let errors = iter::successors(Some(error), |error| error.source());
|
let errors = iter::successors(Some(error), |error| (*error).source());
|
||||||
|
|
||||||
for (ind, error) in errors.enumerate() {
|
for (ind, error) in errors.enumerate() {
|
||||||
write!(f, "\n{:>4}: {}", ind, error)?;
|
write!(f, "\n{:>4}: {}", ind, error)?;
|
||||||
|
@ -8,9 +8,6 @@ use core::ptr::{self, NonNull};
|
|||||||
|
|
||||||
use core::ops::{Deref, DerefMut};
|
use core::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
#[cfg(feature = "pyo3")]
|
|
||||||
mod pyo3_compat;
|
|
||||||
|
|
||||||
impl Report {
|
impl Report {
|
||||||
/// Create a new error object from any error type.
|
/// Create a new error object from any error type.
|
||||||
///
|
///
|
||||||
@ -622,13 +619,12 @@ unsafe fn context_chain_downcast<D>(e: &ErrorImpl<()>, target: TypeId) -> Option
|
|||||||
where
|
where
|
||||||
D: 'static,
|
D: 'static,
|
||||||
{
|
{
|
||||||
|
let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<D, Report>>;
|
||||||
if TypeId::of::<D>() == target {
|
if TypeId::of::<D>() == target {
|
||||||
let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<D, Report>>;
|
|
||||||
let addr = &(*unerased)._object.msg as *const D as *mut ();
|
let addr = &(*unerased)._object.msg as *const D as *mut ();
|
||||||
Some(NonNull::new_unchecked(addr))
|
Some(NonNull::new_unchecked(addr))
|
||||||
} else {
|
} else {
|
||||||
// Recurse down the context chain per the inner error's vtable.
|
// Recurse down the context chain per the inner error's vtable.
|
||||||
let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<D, Report>>;
|
|
||||||
let source = &(*unerased)._object.error;
|
let source = &(*unerased)._object.error;
|
||||||
(source.inner.vtable.object_downcast)(&source.inner, target)
|
(source.inner.vtable.object_downcast)(&source.inner, target)
|
||||||
}
|
}
|
||||||
@ -767,3 +763,6 @@ impl AsRef<dyn StdError> for Report {
|
|||||||
&**self
|
&**self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "pyo3")]
|
||||||
|
mod pyo3_compat;
|
||||||
|
@ -283,7 +283,7 @@
|
|||||||
//! [`simple-eyre`]: https://github.com/yaahc/simple-eyre
|
//! [`simple-eyre`]: https://github.com/yaahc/simple-eyre
|
||||||
//! [`color-spantrace`]: https://github.com/yaahc/color-spantrace
|
//! [`color-spantrace`]: https://github.com/yaahc/color-spantrace
|
||||||
//! [`color-backtrace`]: https://github.com/athre0z/color-backtrace
|
//! [`color-backtrace`]: https://github.com/athre0z/color-backtrace
|
||||||
#![doc(html_root_url = "https://docs.rs/eyre/0.6.4")]
|
#![doc(html_root_url = "https://docs.rs/eyre/0.6.5")]
|
||||||
#![warn(
|
#![warn(
|
||||||
missing_debug_implementations,
|
missing_debug_implementations,
|
||||||
missing_docs,
|
missing_docs,
|
||||||
@ -519,7 +519,7 @@ impl StdError for InstallError {}
|
|||||||
/// return fmt::Debug::fmt(error, f);
|
/// return fmt::Debug::fmt(error, f);
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let errors = iter::successors(Some(error), |error| error.source());
|
/// let errors = iter::successors(Some(error), |error| (*error).source());
|
||||||
///
|
///
|
||||||
/// for (ind, error) in errors.enumerate() {
|
/// for (ind, error) in errors.enumerate() {
|
||||||
/// write!(f, "\n{:>4}: {}", ind, error)?;
|
/// write!(f, "\n{:>4}: {}", ind, error)?;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
///
|
///
|
||||||
/// # fn main() -> Result<()> {
|
/// # fn main() -> Result<()> {
|
||||||
/// # let depth = 0;
|
/// # let depth = 0;
|
||||||
|
/// # let err: &'static dyn std::error::Error = &ScienceError::RecursionLimitExceeded;
|
||||||
/// #
|
/// #
|
||||||
/// if depth > MAX_DEPTH {
|
/// if depth > MAX_DEPTH {
|
||||||
/// bail!(ScienceError::RecursionLimitExceeded);
|
/// bail!(ScienceError::RecursionLimitExceeded);
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
use eyre::eyre;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct Error;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let _ = eyre!(Error);
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
error[E0599]: no method named `eyre_kind` found for reference `&Error` in the current scope
|
|
||||||
--> $DIR/no-impl.rs:7:13
|
|
||||||
|
|
|
||||||
4 | struct Error;
|
|
||||||
| -------------
|
|
||||||
| |
|
|
||||||
| doesn't satisfy `Error: Into<ErrReport>`
|
|
||||||
| doesn't satisfy `Error: eyre::private::kind::TraitKind`
|
|
||||||
| doesn't satisfy `Error: std::fmt::Display`
|
|
||||||
...
|
|
||||||
7 | let _ = eyre!(Error);
|
|
||||||
| ^^^^^^^^^^^^ method not found in `&Error`
|
|
||||||
|
|
|
||||||
= note: the method `eyre_kind` exists but the following trait bounds were not satisfied:
|
|
||||||
`Error: Into<ErrReport>`
|
|
||||||
which is required by `Error: eyre::private::kind::TraitKind`
|
|
||||||
`Error: std::fmt::Display`
|
|
||||||
which is required by `&Error: eyre::private::kind::AdhocKind`
|
|
||||||
`&Error: Into<ErrReport>`
|
|
||||||
which is required by `&Error: eyre::private::kind::TraitKind`
|
|
||||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
Loading…
x
Reference in New Issue
Block a user