Skip to content

Commit

Permalink
Address more review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaDev5 committed Oct 15, 2024
1 parent c141201 commit ac83d5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ SENTRY_API sentry_uuid_t sentry_capture_event(sentry_value_t event);
* This function allows for independently created minidumps to be captured.
*/
SENTRY_API void sentry_capture_minidump(
const char *dump_path, sentry_value_t event);
const char *dump_path, sentry_value_t event, bool removeDumpOnSend);

/**
* Captures an exception to be handled by the backend.
Expand Down
27 changes: 12 additions & 15 deletions src/sentry_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,16 +1171,19 @@ sentry_clear_crashed_last_run(void)
}

void
sentry_capture_minidump(const char *dump_path, sentry_value_t event)
sentry_capture_minidump(const char *dump_path, sentry_value_t event, bool removeDumpOnSend)
{
sentry_path_t *sentry_dump_path
= sentry__path_from_str_n(dump_path, strlen(dump_path));

if(sentry_dump_path == NULL) {
SENTRY_WARN("'sentry_capture_minidump' Failed due to null path to minidump");
return;
}

SENTRY_WITH_OPTIONS (options) {
sentry__write_crash_marker(options);

sentry_envelope_t *envelope = NULL;
sentry_envelope_t *envelope
= NULL;
sentry__ensure_event_id(event, NULL);
envelope = sentry__envelope_new();
if (!envelope || !sentry__envelope_add_event(envelope, event)) {
Expand Down Expand Up @@ -1222,16 +1225,10 @@ sentry_capture_minidump(const char *dump_path, sentry_value_t event)

sentry__capture_envelope(options->transport, envelope);

// now that the envelope was written, we can remove the temporary
// minidump file
sentry__path_remove(sentry_dump_path);
sentry__path_free(sentry_dump_path);

// after capturing the crash event, try to dump all the in-flight
// data of the previous transports
sentry__transport_dump_queue(options->transport, options->run);
// and restore the old transport
}
if(removeDumpOnSend){
sentry__path_remove(sentry_dump_path);
}


sentry__path_free(sentry_dump_path);
}
}

0 comments on commit ac83d5b

Please sign in to comment.