From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6BF591FAD8; Thu, 28 Aug 2014 02:47:42 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Eric Wong Subject: [PATCH 5/5] feed: deal with removed files Date: Thu, 28 Aug 2014 02:47:36 +0000 Message-Id: <1409194056-4735-5-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.1.0.2.g6fb949a.dirty In-Reply-To: <1409194056-4735-1-git-send-email-e@80x24.org> References: <1409194056-4735-1-git-send-email-e@80x24.org> List-Id: Sometimes we get spam and need to delete messages, we must prevent errors on missing messages from propagating. --- lib/PublicInbox/Feed.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 1eaba6c..646c85c 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -291,8 +291,11 @@ sub dump_msg { sub do_cat_mail { my ($git, $path) = @_; - my $str = $git->cat_file("HEAD:$path"); - Email::MIME->new($str); + my $mime = eval { + my $str = $git->cat_file("HEAD:$path"); + Email::MIME->new($str); + }; + $@ ? undef : $mime; } 1; -- EW