Comments (4)
I haven't considered it, as we haven't adopted grpc yet. Did you have thoughts on how an extension would look? Were you thinking of WithGRPCCode()/GRPCCode() functions? Would it be appropriate for HTTPCode and GRPCCode functions to interact, using each other for defaults it one or the other isn't set?
from merry.
Maybe it doesn't have to do anything with HTTP codes. For example
import "google.golang.org/grpc/codes"
merry.New("merry error").WithGRPCCode(codes.NotFound)
And internally, it just adds a new errorProperty "grpcCode" to the values, in parallel with httpCode.
from merry.
I looked into this a bit. I don't really want to import grpc into merry. It's a dependency which most projects don't need. I could do WithGRPCCode(uint32) to avoid the import, but I think that would greatly diminish its value.
Also, it looks like it would be useful for errors to implement GRPCStatus() *Status
, but again, that can't be implemented without importing grpc.
This could be implemented in its own package, but then, it wouldn't be much effort for you to implement these convenience methods in your own project. merry's Value()
and WithValue()
functions are intended to be used to implement your own custom error attributes as needed.
from merry.
Thanks, make sense
from merry.
Related Issues (18)
- Deal with nil errors HOT 1
- Support a "Prepend" function to compliment "Append" HOT 1
- Support a way to set both the user message and the internal message to the same thing when creating a new error HOT 1
- Add a Cause property HOT 3
- Add flag with causes e.Error() to return the same as merry.Details(e) HOT 1
- merry.Details() does not print attached values HOT 2
- Add "Append" and "Appendf" functions/methods HOT 1
- Add a way to use predefined merry errors to wrap HOT 7
- How print registered details, without stacktrace HOT 3
- merry v1.6.0 fails go get HOT 2
- How could i serialize and deserialize error to json? HOT 1
- merry.Errorf returns a stdlib error in some cases which breaks %+v HOT 3
- Should Location() return empty string? HOT 3
- Tests fail (nil value handling) HOT 2
- Value extraction HOT 2
- Support callbacks to add context to a merry error when it is first captured HOT 7
- Support another builtin property: UserMessage HOT 1
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 merry.