mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 10:02:02 -04:00
Make Artwork robust to EbookNotFoundException
This probably means the Ebook is unreleased, but the artwork page can still show the EbookUrl. Found this error during testing of the ebook DB here: https://github.com/standardebooks/web/pull/401#issuecomment-2450588117
This commit is contained in:
parent
7e67e108f3
commit
0138b19000
1 changed files with 7 additions and 4 deletions
|
@ -258,9 +258,6 @@ class Artwork{
|
||||||
return $this->_Dimensions;
|
return $this->_Dimensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exceptions\EbookNotFoundException
|
|
||||||
*/
|
|
||||||
protected function GetEbook(): ?Ebook{
|
protected function GetEbook(): ?Ebook{
|
||||||
if($this->_Ebook === null){
|
if($this->_Ebook === null){
|
||||||
if($this->EbookUrl === null){
|
if($this->EbookUrl === null){
|
||||||
|
@ -268,7 +265,13 @@ class Artwork{
|
||||||
}
|
}
|
||||||
|
|
||||||
$identifier = 'url:' . $this->EbookUrl;
|
$identifier = 'url:' . $this->EbookUrl;
|
||||||
$this->_Ebook = Ebook::GetByIdentifier($identifier);
|
try{
|
||||||
|
$this->_Ebook = Ebook::GetByIdentifier($identifier);
|
||||||
|
}
|
||||||
|
catch(Exceptions\EbookNotFoundException){
|
||||||
|
// The ebook is probably unreleased.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_Ebook;
|
return $this->_Ebook;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue