You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to send errors with stack trace information to Bugsnag after serializing and deserializing them. For that, I need to be able to create an errors.Error variable outside of the runtime where the error occurred. Currently, if I understand correctly, it's impossible to "rebuild" the stack frames after deserializing, because that's done by interacting with the runtime using the program counter.
I'd like to introduce a
type ErrorWithStackFrames interface {
error
StackFrames() []StackFrame
}
which would then be included in the type switch in New. Error.stack would be set to nil, and Error.frames would be populated from the ErrorWithStackFrames.StackFrames() method.
The documentation of the Error.Callers() method would need to be updated to tell users it might return nil, but it's not used in the package itself and I'm not sure who would be using this in the first place. The Error.StackFrames() method would work just like before.
Let me know if you want me to prepare a pull request for this feature, or if it's not something you want to support.
The text was updated successfully, but these errors were encountered:
Hi @alexanderwilling, thanks for the thoughtful enhancement suggestion.
Currently, if I understand correctly, it's impossible to "rebuild" the stack frames after deserializing, because that's done by interacting with the runtime using the program counter.
Correct. I think your proposal makes sense for other use cases where the program counter is not available.
The documentation of the Error.Callers() method would need to be updated to tell users it might return nil, but it's not used in the package itself and I'm not sure who would be using this in the first place.
I think your proposal is good. If you’d like to discuss over a pull request, I believe the only required changes would be to add the interface and add a case for it (similar to the one for ErrorWithCallers). Though perhaps it would be helpful to add an example usage to the examples dir so it can be referenced from the docs. Thanks again!
I'd like to send errors with stack trace information to Bugsnag after serializing and deserializing them. For that, I need to be able to create an
errors.Error
variable outside of the runtime where the error occurred. Currently, if I understand correctly, it's impossible to "rebuild" the stack frames after deserializing, because that's done by interacting with the runtime using the program counter.I'd like to introduce a
which would then be included in the type switch in
New
.Error.stack
would be set to nil, andError.frames
would be populated from theErrorWithStackFrames.StackFrames()
method.The documentation of the
Error.Callers()
method would need to be updated to tell users it might returnnil
, but it's not used in the package itself and I'm not sure who would be using this in the first place. TheError.StackFrames()
method would work just like before.Let me know if you want me to prepare a pull request for this feature, or if it's not something you want to support.
The text was updated successfully, but these errors were encountered: