Comments (6)
Something like https://play.rust-lang.org/?gist=f98139dcdd16cceb898731f0fe649a34&version=stable&backtrace=0?
from error-chain.
Wrapping the whole thing in a macro (which expects a closure as an argument) seems a little too magic to me. I'd prefer a helper like the toplevel_unwrap()
I suggested above, or at most, a macro that takes a function name (chain_main!(real_main);
).
Then again, I suppose you could pass a function name instead of a closure, so sure. But I'd still like the helper function version as well. And both the helper function and the macro should print the causes and possible backtrace, as shown in that blog entry.
from error-chain.
Yeah, it's just that I was on play.rust-lang.org, which doesn't allow the use of other crates.
How would you implement it? A trait on Result?
from error-chain.
Right. error-chain already provides a trait on Result, so this would just add one method to it.
from error-chain.
In fact, not exactly: ResultExt is defined on Result<T, E> where E: Error
, and not E: ChainedError
.
from error-chain.
Good point; in the absence of some kind of specialization, that trait wouldn't work. But another trait could.
from error-chain.
Related Issues (20)
- If this crate is really drepecate, I should specify it and mark alternatives. HOT 8
- cargo publish error HOT 3
- deprecate quick_main?
- trait objects without an explicit `dyn` are deprecated
- changes to backtrace crate HOT 1
- Shouldn't src/bin/has_backtrace.rs be in examples? HOT 1
- How to implement complex display expression?
- backtrace name collision HOT 1
- use of deprecated try
- minimum version 1.13 for ? operator HOT 1
- How to force documentation when using error_chain HOT 5
- Move Repository To rust-lang
- lint error: use of deprecated item 'std::error::Error::description': use the Display impl or to_string() HOT 2
- Rust 2018 macro export pain HOT 3
- gcc error while testing HOT 3
- Release 0.12.2? HOT 8
- Chaining errors from spawned threads.
- Use feature specific links in error_chain! macro
- Add a feature gate to call DebugBreak on construction
- no rules expected this token in macro call 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 error-chain.