fn upload_minidumps(crash_dir: &Path, hub: &sentry_core::Hub) {
        // Scan the directory the integration was initialized with to find any
        // envelopes that have been serialized to disk and send + delete them
        let rd = match std::fs::read_dir(crash_dir) {
            Ok(rd) => rd,
            Err(e) => {
                debug_print!(
                    "Unable to read crash directory '{}': {}",
                    crash_dir.display(),
                    e
                );
                return;
            }
        };

        let client = match hub.client() {
            Some(c) => c,
            None => return,
        };

        // The minidumps are what we care about the most, but of course, the
        // metadata that we (hopefully) were able to capture along with the crash
        for entry in rd.filter_map(|e| e.ok()) {
            if entry
                .file_name()
                .to_str()
                .map_or(true, |s| !s.ends_with(".dmp"))
            {
                continue;
            }

            let mut minidump_path = entry.path();
            minidump_path.set_extension("metadata");

            let md = crate::shared::CrashMetadata::deserialize(&minidump_path);
            if let Err(e) = std::fs::remove_file(&minidump_path) {
                debug_print!("failed to remove {}: {}", minidump_path.display(), e);
            }

            minidump_path.set_extension("dmp");

            let envelope = crate::shared::assemble_envelope(md, &minidump_path);
            if let Err(e) = std::fs::remove_file(&minidump_path) {
                debug_print!("failed to remove {}: {}", minidump_path.display(), e);
            }

            client.send_envelope(envelope);
        }
    }
/// Called during startup to send any minidumps + metadata that have been
/// captured in previous sessions but (seem to) have not been sent yet
Called during startup to send any minidumps + metadata that have been
captured in previous sessions but  have not been sent yet
Called during startup to send any minidumps + metadata that have been captured in previous sessions but have not been sent yet
fn upload_minidumps(crash_dir: &Path, hub: &sentry_core::Hub) {
        // Scan the directory the integration was initialized with to find any
        // envelopes that have been serialized to disk and send + delete them
        let rd = match std::fs::read_dir(crash_dir) {
            Ok(rd) => rd,
            Err(e) => {
                debug_print!(
                    "Unable to read crash directory '{}': {}",
                    crash_dir.display(),
                    e
                );
                return;
            }
        };
        let client = match hub.client() {
            Some(c) => c,
            None => return,
        };
        // The minidumps are what we care about the most, but of course, the
        // metadata that we (hopefully) were able to capture along with the crash
        for entry in rd.filter_map(|e| e.ok()) {
            if entry
                .file_name()
                .to_str()
                .map_or(true, |s| !s.ends_with(".dmp"))
            {
                continue;
            }
            let mut minidump_path = entry.path();
            minidump_path.set_extension("metadata");
            let md = crate::shared::CrashMetadata::deserialize(&minidump_path);
            if let Err(e) = std::fs::remove_file(&minidump_path) {
                debug_print!("failed to remove {}: {}", minidump_path.display(), e);
            }
            minidump_path.set_extension("dmp");
            let envelope = crate::shared::assemble_envelope(md, &minidump_path);
            if let Err(e) = std::fs::remove_file(&minidump_path) {
                debug_print!("failed to remove {}: {}", minidump_path.display(), e);
            }
            client.send_envelope(envelope);
        }
    }
fn upload_minidumps ( crash_dir : & Path , hub : & sentry_core :: Hub ) { // Scan the directory the integration was initialized with to find any // envelopes that have been serialized to disk and send + delete them let rd = match std :: fs :: read_dir ( crash_dir ) { Ok ( rd ) => rd , Err ( e ) => { debug_print ! ( " " crash_dir display ( ) e ) ; return ; } } ; let client = match hub . client ( ) { Some ( c ) => c , None => return , } ; // The minidumps are what we care about the most, but of course, the // metadata that we (hopefully) were able to capture along with the crash for entry in rd . filter_map ( | e | e . ok ( ) ) { if entry . file_name ( ) . to_str ( ) . map_or ( true , | s | ! s . ends_with ( " " ) ) { continue ; } let mut minidump_path = entry . path ( ) ; minidump_path . set_extension ( " " ) ; let md = crate :: shared :: CrashMetadata :: deserialize ( & minidump_path ) ; if let Err ( e ) = std :: fs :: remove_file ( & minidump_path ) { debug_print ! ( " " minidump_path display ( ) e ) ; } minidump_path . set_extension ( " " ) ; let envelope = crate :: shared :: assemble_envelope ( md , & minidump_path ) ; if let Err ( e ) = std :: fs :: remove_file ( & minidump_path ) { debug_print ! ( " " minidump_path display ( ) e ) ; } client . send_envelope ( envelope ) ; } }
Called during startup to send any minidumps + metadata that have been
captured in previous sessions but (seem to) have not been sent yet
Called during startup to send any minidumps + metadata that have been captured in previous sessions but ( seem to ) have not been sent yet
crash_dir
&Path
hub
&sentry_core::Hub