From f8da23ab9d593fec39f96193a7727a9d3e4d119b Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Fri, 16 Aug 2019 15:57:54 -0500 Subject: [PATCH] Don't crash the whole catalog if one book doesn't parse correctly --- lib/Library.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Library.php b/lib/Library.php index 260b1d73..3fe2447e 100644 --- a/lib/Library.php +++ b/lib/Library.php @@ -112,8 +112,13 @@ class Library{ $ebook = apcu_fetch('ebook-' . $ebookWwwFilesystemPath); } catch(Safe\Exceptions\ApcuException $ex){ - $ebook = new Ebook($ebookWwwFilesystemPath); - apcu_store('ebook-' . $ebookWwwFilesystemPath, $ebook); + try{ + $ebook = new Ebook($ebookWwwFilesystemPath); + apcu_store('ebook-' . $ebookWwwFilesystemPath, $ebook); + } + catch(InvalidEbookException $ieEx){ + // Do nothing if one specific ebook is causing problems + } } $ebooks[] = $ebook;