Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Invoke before_send hook when using Crashpad #519

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ typedef struct sentry_options_s sentry_options_t;
* In case of `false`, sentry will log an error, but continue with freeing the
* transport.
* * `free_func`: Frees the transports `state`. This hook might be called even
* though `shudown_func` returned `false` previously.
* though `shutdown_func` returned `false` previously.
*
* The transport interface might be extended in the future with hooks to flush
* its internal queue without shutting down, and to dump its internal queue to
Expand Down
8 changes: 8 additions & 0 deletions src/backends/sentry_backend_crashpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ sentry__crashpad_handler(int UNUSED(signum), siginfo_t *UNUSED(info),
SENTRY_WITH_OPTIONS (options) {
sentry__write_crash_marker(options);

sentry_value_t event = sentry_value_new_event();
if (options->before_send_func) {
SENTRY_TRACE("invoking `before_send` hook");
event = options->before_send_func(
event, NULL, options->before_send_data);
}
sentry_value_decref(event);

sentry__record_errors_on_current_session(1);
sentry_session_t *session = sentry__end_current_session_with_status(
SENTRY_SESSION_STATUS_CRASHED);
Expand Down