Open ldreux opened 1 year ago
Maybe we adopt this exact use case? Instead of API focused on just exposing stack frames, make an api for conversion. This would highlight that you don't need to extract this information as-is, but if you need to feed it to some system with custom stack frames format, you can. Such conversion API can also be based on interface for errorx frame, not the actual representation, as an added bonus. What's your view on such idea?
For monitoring tools like github.com/getsentry/sentry-go
, it's important to expose the callstack so the error can be traced.
This is how Sentry extracts stack trace from other error libraries. While I don't think errorx
should necessarily adhere to the way Sentry parses stack trace, an exposed API to get the frames from the Error
should be available for custom stack trace parsing.
Instead of API focused on just exposing stack frames, make an api for conversion. This would highlight that you don't need to extract this information as-is, but if you need to feed it to some system with custom stack frames format, you can.
Im not sure how a conversion API for call stack works, can you provide an example?
As far as I can recall, the idea was that we add an API like this:
func (e *Error) ExportStackFrames(originalFrames []FrameInterface) any
This way, we:
In this PR, the second point is already addressed, so I'm generally OK with that. Just asked for an opinion on an idea.
In our applications, we catch all errors in our webservices and our batches and create sentry issues with the errorx stacktrace.