sentry-native
sentry-native copied to clipboard
Show user dialog before sending crash report ?
Description
The Sentry web SDK has a neat option to show a dialog to the user where one can enter additional information that can be very valuable in investigating what caused the bug.
I cannot seem to find any callback that we could hook into to achieve this.
I was thinking perhaps this could be achieved through crashpad::CrashpadClient::SetFirstChanceExceptionHandler,
but sentry is already registering its own callback in sentry__crashpad_backend_startup().
It would be awesome if Sentry provided something like sentry_options_set_before_send() for this,
i.e. sentry_options_set_before_crash_send() where one could display a simple OS message box,
retrieve user entry and add it to the payload.
When does the problem happen
- [ ] During build
- [x] During run-time
- [x] When capturing a hard crash
Environment
- OS: Windows/macOS
- Compiler: N/A
- CMake version and config: SENTRY_BACKEND=crashpad
When using the crashpad backend, you would have to build your own crashpad handler.
The CMake script should export a crashpad_handler_lib target which you can link to make this possible.
As you said, the before_send hook can be used when using the non-crashpad backends to do this.
@Swatinem I think it is a generally useful feature being able to hook into the handler's upload cycle, so this would be something we should consider exposing somehow. The patch for getting custom code into the handler is actually quite small, but building this transparently can become challenging.
Thanks @Swatinem, so I forked crashpad, which isn't ideal but allows me to test the implementation quickly.
I added a report dialog in CrashReportExceptionHandler::ExceptionHandlerServerException.
This works, however I'm not too clear on how to pass back the user data back to sentry, in order to add it as extra data to the sentry event. Maybe you have some ideas about this ?