From d604b629174284adfeafb3ccd1f067432057eb70 Mon Sep 17 00:00:00 2001 From: Bat Date: Thu, 24 May 2018 12:20:11 +0100 Subject: [PATCH] Make it easier to debug inbox errors --- src/activity_pub/inbox.rs | 4 ++-- src/models/users.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/activity_pub/inbox.rs b/src/activity_pub/inbox.rs index 6b2c624a..1b45b442 100644 --- a/src/activity_pub/inbox.rs +++ b/src/activity_pub/inbox.rs @@ -114,8 +114,8 @@ pub trait Inbox { "Create" => { let act: Create = serde_json::from_value(act.clone())?; match act.object["type"].as_str().unwrap() { - "Article" => self.new_article(conn, act.object_object().unwrap()), - "Note" => self.new_comment(conn, act.object_object().unwrap(), act.actor_object::()?.object_props.id_string()?), + "Article" => self.new_article(conn, act.object_object()?), + "Note" => self.new_comment(conn, act.object_object()?, act.actor_object::()?.object_props.id_string()?), _ => Err(InboxError::InvalidType)? } }, diff --git a/src/models/users.rs b/src/models/users.rs index 79c37ad9..55b3f181 100644 --- a/src/models/users.rs +++ b/src/models/users.rs @@ -439,7 +439,7 @@ impl WithInbox for User { impl Inbox for User { fn received(&self, conn: &PgConnection, act: serde_json::Value) { if let Err(err) = self.save(conn, act.clone()) { - println!("Inbox error:\n{}\n{}", err.cause(), err.backtrace()); + println!("Inbox error:\n{}\n{}\n\nActivity was: {}", err.cause(), err.backtrace(), act.to_string()); } // Notifications