Comments (1)
It's not possible to serialize an error to an exact representation, because error is just an interface, and merry is just a linked list of error interfaces.
You could define a JSON schema for an error that contains the main error attributes merry supports (like HTTP code, user message, stacktrace, source line, etc), or you could try serializing the result of merry.Details(err), but that is a little dangerous, since you don't know the types of the values in that map, and not all types serialize to JSON.
In most RPC APIs I've seen, there is an error structure defined by the API. That error structure is often language-agnostic, so it can be implemented by any language that implements the API. Golang errors (including merry errors) would be converted to and from that API error structure.
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
- gRPC codes HOT 4
- 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
- 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.