File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 3
3
namespace Code16 \LaravelTiteliveClient \Utils ;
4
4
5
5
use Code16 \LaravelTiteliveClient \Api \Clients \BookCache ;
6
+ use Code16 \LaravelTiteliveClient \Api \Clients \TiteLive \TiteLiveBookNotFoundException ;
6
7
use Code16 \LaravelTiteliveClient \Book ;
7
8
use Illuminate \Database \Eloquent \Casts \Attribute ;
8
9
use Illuminate \Support \Collection ;
@@ -19,9 +20,14 @@ public function refreshBooks(bool $force = false): self
19
20
$ this ->update ([
20
21
'books ' => $ this ->books
21
22
->map (function (Book $ book ) use ($ force ) {
22
- return app (BookCache::class)
23
- ->force ($ force )
24
- ->refreshIfNeeded ($ book );
23
+ try {
24
+ $ refreshedBook = app (BookCache::class)
25
+ ->force ($ force )
26
+ ->refreshIfNeeded ($ book );
27
+ } catch (TiteLiveBookNotFoundException $ e ) {
28
+ return null ;
29
+ }
30
+ return $ refreshedBook ;
25
31
})
26
32
->filter ()
27
33
->values ()
You can’t perform that action at this time.
0 commit comments