Comments (3)
That sounds great to me. I filed one suggestion but I am excited to see this go forward.
from anyhow.
I started working on a new crate, core-error
- exposing our own version of the Error
trait. The goal of this crate is twofolds:
- Provide a common trait for various error handling crates (Failure, Snafu, Fehler, Anyhow, error_chain, and any other)
- Allow no_std libraries that don't want to depend on a specific error handling crate to still expose errors that can interoperate with those libraries.
Such a crate would work like this:
- With the std feature, it just re-export
std::error::*
- With
no-default-features
, it exposes anError
trait similar to the one instd
but without backtraces, and without the std/alloc-only impls. - Rustc version auto-detection is used to figure which errors to implement the trait on.
- The alloc feature enables downcasting, in addition to supporting alloc errors
- The crate would compile on all versions from 1.0.0 to the latest stable version.
The trait will be compatible with std's Error trait, and if libcore gains an Error trait in the future, it should be compatible with it too.
Once the crate reaches 1.0.0, I'll consider it ready for integration in the various error crates and will follow the same stability guarantee Rust does: No breaking changes ever.
Work has already started in https://github.com/core-error/core-error. I'd be interested in hearing feedback on the design!
from anyhow.
Closing as I don't think I need to track this here, we can follow up in issues of the core-error repo.
from anyhow.
Related Issues (20)
- Use `#[track_caller]` to provide info on where the error was created HOT 1
- Allow source errors to expose their own context? HOT 1
- `build.rs` should not detect nightly feature HOT 11
- [Question] In `{:#?}` why is the outermost context called "caused by" and how is `Context` expected to be used? HOT 1
- `ensure!` macro implementation details HOT 8
- Nightly feature wrongly enabled on stable toolchain HOT 3
- Should `anyhow::Error::chain` return `dyn Error + Send + Sync` HOT 2
- Customize backtrace logic?
- `anyhow!(e)` doesn't preserve `source` for `&Error` HOT 1
- A way to disable anyhow stacktraces (without disabling stacktraces from other crates) HOT 2
- Default Ok-type to `()` in `anyhow::Result` typedef HOT 2
- Updating from version 1.0.76 breaks backtraces HOT 2
- Make backtrace support optional HOT 9
- Possible performance regression on Windows HOT 5
- as_ref() type must be known at this point
- Depending on `CARGO_ENCODED_RUSTFLAGS` may produce stale builds HOT 1
- rust-analyzer nightly throws needless_return warning on bail! HOT 2
- Implement Context for Error
- Question regarding stacktrace
- anyhow::Error to Box<dyn Error> isn't compatible with other libraries HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anyhow.