I don’t know Rust, but trying to hack on Lemmy 0.18.1 enough to get a better error message out.

error: data did not match any variant of untagged enum AnnouncableActivities

where: crates/apub/src/activities/community/announce.rs, line: 46

https://github.com/LemmyNet/lemmy/blob/0c82f4e66065b5772fede010a879d327135dbb1e/crates/apub/src/activities/community/announce.rs#L46

That seems to be the function parameters themselves?

Is the error caused by RawAnnouncableActivities not matching the enum AnnouncableActivities and the try_into?

  warn!("zebratrace receive {:?}", self);

Works for adding logging, but I’d like the code to log self only when the enum does not match (errors). Thank you.

  • RoundSparrowOP
    link
    fedilink
    English
    11 year ago

    let object = match self.clone().try_into::<AnnouncableActivities>() { Ok(object) => object, Err(e) => { warn!(“zebratrace receive {:?}”, self); return Err(e); } }

    Compiler didn’t like your code:

    let object = match self.clone().try_into::<AnnouncableActivities>() {
       |                                     ^^^^^^^^ expected 0 generic arguments
       |
    help: consider moving this generic argument to the `TryInto` trait, which takes up to 1 argument
       |
    52 |     let object = match TryInto::<AnnouncableActivities>::try_into(self.clone()) {
       |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    help: remove these generics
       |
    52 -     let object = match self.clone().try_into::<AnnouncableActivities>() {
    52 +     let object = match self.clone().try_into() {
    
    
    • @colonial
      link
      English
      51 year ago

      Yeah, I thought I was botching something important.

      This should work:

      let object: AnnouncableActivities = match self.clone().try_into() {
      
        • @colonial
          link
          English
          51 year ago

          No problem! Don’t be afraid to ask if you’ve got any other questions :D