Skip to content

Commit 7ee2887

Browse files
authored
also catch resource unavailable exceptions when resolving entry fields (#33)
1 parent 37e9858 commit 7ee2887

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Entry.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Markup\Contentful;
44

55
use Markup\Contentful\Exception\LinkUnresolvableException;
6+
use Markup\Contentful\Exception\ResourceUnavailableException;
67

78
class Entry implements EntryInterface
89
{
@@ -62,6 +63,8 @@ public function getField($key)
6263
$resolvedLink = call_user_func($this->resolveLinkFunction, $this->fields[$key])->wait();
6364
} catch (LinkUnresolvableException $e) {
6465
$resolvedLink = null;
66+
} catch (ResourceUnavailableException $e) {
67+
$resolvedLink = null;
6568
}
6669
$this->resolvedLinks[$key] = $resolvedLink;
6770
}
@@ -76,6 +79,8 @@ public function getField($key)
7679
} catch (LinkUnresolvableException $e) {
7780
//if the link is unresolvable we should consider it not published and return null so this is filtered out
7881
return null;
82+
} catch (ResourceUnavailableException $e) {
83+
return null;
7984
}
8085

8186
return $resolvedLink;

0 commit comments

Comments
 (0)