-
-
Notifications
You must be signed in to change notification settings - Fork 276
Description
Why I need this (very much!)
My code is like:
void main_function() {
try {
inner_function(); // indeed, functions calling functions calling functions... so the calling stack is deep
} catch (e,s) {
Sentry.captureException(e, s);
}
}
void inner_function() {
var my_data = ...;
try {
do_some_work_that_can_throw_exception(my_data);
} catch (e,s) {
Sentry.pleaseBindAttachmentToException(e, my_data); // <-- !!
rethrow;
}
}Notice the Sentry.pleaseBindAttachmentToException, where I want to bind attachment to exception.
However, as we know, we cannot do it. I can create some code to bind extra to exception, because extra can be modified in EventProcessors (so I can manually create a static map holding some extras and bind to exception in my own EventProcessor). However, EventProcessors cannot modify or add attachments. So I have no way to do it :(
Proposed solution
Say, add a field to SentryOptions, e.g. void Function(Scope)? withScopeWhenCapture. Then, in Hub.captureException and similar places, call that callback. This is very simple and I will implement it if you like.
related: #646
Hi @marandaneto could you please have a look (since this thread is strongly related to #646)? Thanks! And @ueman could you please also have a look? Thanks!
Metadata
Metadata
Assignees
Labels
Projects
Status