Comments (3)
Since Dipstick itself doesnt return errors and only propagates the errors from other layers, just boxing them up seemed to be the simplest way, no failure
crate / dependency required. Could just adding Send + Sync
to the Boxed trait satisfy your requirements? What would be the gain in returning a concrete Dipstick Error struct? All it would do (for now) is wrap other errors...
from dipstick.
Send + Sync
is a good start (things that are not are really hard to work with and mostly incompatible with any crate that helps with error handling). In the case of just propagating, it might be a good solution.
The advantage of an enum wrapper around concrete types are:
- You can see in documentation what erros may happen.
- All the
Send
,Sync
and possibly other auto-traits are handled by the compiler. - It's a bit easier to handle some of the errors in a different way than the rest, by matching. You can still downcast the boxed ones, but that's a bit more work.
from dipstick.
I've made a PR to add Send + Sync
to boxed errors.
For the record, I also I rewrote an Error enum
, but pulled it back. Maintaining an Enum along with the required From
impls is not something I want to commit to as it feels the whole Rust error management is still in shift anyway and a better way might yet come up. Also, it's not a showstopper, especially as the errors currently being reported are probably not rich enough to mandate handling them in a match
. I understand your points though and will keep them in mind when it's time to revisit the error mechanism.
from dipstick.
Related Issues (20)
- Upgrade to Rust 2018 edition HOT 5
- Timer default output format HOT 1
- Single Thread, Replaceable Scheduler HOT 1
- Full Prometheus support (pull-based HTTP endpoint) HOT 8
- Use CircleCI (or other) instead of Travis
- Pre-populated metrics for statsd and similar push models HOT 5
- Proc_macros HOT 2
- Purpose of Instant in the Observe's Fn(Instant) callback HOT 1
- Impossible removal of observed metrics, resource leaks HOT 1
- Observe effectively unimplementable for out-of-crate types HOT 3
- Fails to compile under newest nightly HOT 1
- Prometheus Never Prints the Buffer HOT 9
- Impl Output for Log HOT 2
- Feature: CancelGuard HOT 5
- Panic at already BorrowMutError HOT 3
- Can't compile without default features HOT 3
- Exporting Result at the crate root can cause conflicts with std::result::Result HOT 2
- Accumulate metrics HOT 6
- Example of a pull strategy HOT 2
- Can't implement own Output, because attributes::MetricId is private
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 dipstick.