Comments (6)
I personally would think that the easiest and most versatile solution would be to attach a simple dictionary to the error itself. Simple string as the key and an object as the value. My PR #37 could be used like this:
var metadata = new Dictionary<string, object>();
metadata.Add("id", 13947);
var error = Error.Failure("404", "entity not found", metadata);
Let me know what you think.
from error-or.
Different use cases:
- environment metadata (helpful if the customer gives you only a screenshot of an error)
- user context (session data, etc)
- working with background APIs you may want to know which component is the real culprit (or if it was a resillience error)
- compressed stacktrace, compressed binary log data
And this are only the ones on top of my head or ones I already have encountered.
from error-or.
Hmm, this is an interesting idea. What kind of metadata are we talking about? Is this a specific recurring object you want to attach to all errors? a string? Can you elaborate on the use case?
from error-or.
@amantinband Good evening. I was looking at using ErrorOr<> in our solution.
Currently, we use fluent validation with https://github.com/shanerogers/language-ext.
More specifically Result This is similar to your example (in docs) with mediatR with behaviours.
However, I also need meta-data used in our problem json responses. So this is also a blocker for me.
Also worth mentioning. Is it possible to have 'PropertyName' as a field? So each error can have the following:
- ErrorCode
- PropertyName
- Description
- ErrorType
- Metadata
I also find the Numeric type isn't something I need. Also, wondering how that works with 'Custom' types.
from error-or.
I would really need this
from error-or.
Added since I see many of you want this feature. Should be available in version 1.4.0 🙂
from error-or.
Related Issues (20)
- Add Stacktrace property to the Error struct HOT 3
- Is there an ability to chain multiple validation methods returning ErrorOr<T>? HOT 14
- [Request] Please sign the NuGet with a strong name HOT 2
- [Bug] Error equality not working as intended HOT 4
- SUGGESTION: Add a changelog for each version released HOT 1
- erroror is missing NuGet package README file HOT 2
- Return ErrorOr<?> HOT 2
- [Request] Add overload without capturing errors or values in functional methods
- [Bug/Enhancement] ErrorOr should not "invent" a result value in case error, it should force caller to handle error instead HOT 6
- [Question] ASP.net Is there a response type i can deserialize to? HOT 2
- [Enhancement] Add FailIf from Task<T>
- [Question] Error Result from MediatR pipeline behaviour HOT 2
- [Enhancement] Avoid duplicated runtime memory by moving NoFirstError and NoErrors into non-generic type HOT 1
- [Question]: Should it be possible to instantiate ErrorOr<TValue> with an empty error list? HOT 8
- MatchAsync giving an error when IActionResult is returned from Api Contoller. HOT 3
- Potential misuse HOT 4
- How this project is related to CSharpFunctionalExtensions? HOT 4
- FailIf example does not work HOT 2
- Extend API to facilitate multiple error handling HOT 3
- Should Error instances have a dedicated Exception property?
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-or.