Comments (9)
What do you mean? Do you have an example?
from error-chain.
I am building a library that's called from languages. More explicitly, I am writing multiple plugins for IDEs. Each IDE has its own plugin and system language. As such, not to have to rewrite most of the logic, I use rust as a common backend. I use Json to communicate, transmitted with pointers as strings to communicate between the rust and the plugin. One of the shortcoming of that serialization are two things with error-chain
I need to be able to serialize the backtrace to transmit it to the calling plugin. And I need some way of identifying errors based on some other thing than the message error itself. That's why I want to add error codes, to be able to send error identification information through the frontier between rust and the plugin. (Hope that's more clear)
from error-chain.
You mean that you want to be able to associate some data to an error?
from error-chain.
yes, data conditional to the type of the error
from error-chain.
You can already do that for normal errors, and you would like to do it for links
and foreign_links
errors? Any idea about which macro change you would like?
from error-chain.
What do you mean, I can do it for normal errors? In the errors
block within the error_chain
macro?
As for the macro change we could have a codes
block that associates foreign_links
and links
to a string (or usize) code like so:
codes {
Temp, "#0001";
}
To access it we could have a .code
method on the error that returns the corresponding error code.
from error-chain.
you can do
errors {
Temp(code: u16) {}
}
I don't really see what would be the benefit. I thought you where talking about getting the code above to work with links
from error-chain.
I was, the Temp
was supposed to be a foreign link. In the example I went for the result of the mapping.
However, if we can use the result of the mapping to add custom fields then there might not need any addition to the macro.
from error-chain.
something like this then?
foreign_links {
io::Error, Io<u16>;
}
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.