Make it easier to debug inbox errors

This commit is contained in:
Bat 2018-05-24 12:20:11 +01:00
parent ef815a436b
commit d604b62917
2 changed files with 3 additions and 3 deletions

View file

@ -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::<Person>()?.object_props.id_string()?),
"Article" => self.new_article(conn, act.object_object()?),
"Note" => self.new_comment(conn, act.object_object()?, act.actor_object::<Person>()?.object_props.id_string()?),
_ => Err(InboxError::InvalidType)?
}
},

View file

@ -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