sentry-rust icon indicating copy to clipboard operation
sentry-rust copied to clipboard

Unnamed event

Open italiks opened this issue 2 years ago • 4 comments

Environment

Windows 10, Mac OS Sentry 0.27

Steps to Reproduce

I use the following function to send crash dump. Everything works great except all events have the same name - < unnamed >

pub fn send_crash_dump(crash_dump: &PathBuf) {
  with_scope(
    |scope| {
      let filename = format!(
        "{:}.dmp",
        crash_dump
          .parent()
          .unwrap()
          .file_name()
          .unwrap()
          .to_os_string()
          .into_string()
          .unwrap()
      );
      scope.add_attachment(Attachment {
        ty: Some(AttachmentType::Minidump),
        buffer: std::fs::read(crash_dump.as_path()).unwrap(),
        filename,
        content_type: None,
      })
    },
    || {
      let crash_info = crash_dump
        .file_name()
        .unwrap()
        .to_os_string()
        .into_string()
        .unwrap();
      let event = Event {
        exception: vec![Exception {
          ty: "native unhandled exception".into(),
          mechanism: Some(Mechanism {
            ty: "native crash handler".into(),
            handled: Some(false),
            ..Default::default()
          }),
          value: Some(format!("Unhandled exception. {}", &crash_info)),
          ..Default::default()
        }]
        .into(),
        message: Some(format!("Unhandled exception. {}", &crash_info)),
        level: Level::Fatal,
        ..Default::default()
      };

      let confirm_uuid = sentry::capture_event(event);
      if confirm_uuid == Uuid::nil() {
        println!("failed to capture native event");
      }
    },
  );
}

Expected Result

Event has 'Unhandled exception...' name

Actual Result

Event has < unnamed > name

italiks avatar Dec 08 '22 13:12 italiks

Why are you manually constructing the exception and message?

When you supply a minidump Sentry pulls these from the minidump.

timfish avatar Dec 09 '22 00:12 timfish

Why are you manually constructing the exception and message?

In the project I work on there are some third party native libraries and crash can occur in some of those. So I setup a global unhandled exception handler where I create a dump and manually create exception and message objects.

Is there a better approach for the problem? If so could you please share.

When you supply a minidump Sentry pulls these from the minidump.

By any chance do you know how to setup it in minidump?

italiks avatar Dec 09 '22 10:12 italiks

To differentiate between different sources of errors I think it's recommended to use tags.

configure_scope(|scope| {
    scope.set_tag("source", "lib-bad");
});

timfish avatar Dec 09 '22 11:12 timfish

When you supply a minidump Sentry pulls these from the minidump.

@timfish by any chance do you know what property it looks for the name?

italiks avatar Dec 21 '22 17:12 italiks