Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 42a39e7

Browse files
committed
Improve error message when thumbs dir is missing. Closes #19
1 parent fc4483b commit 42a39e7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/cache.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Cache\Driver\File as FileCache;
66
use Dir;
7+
use Error;
78
use F;
89
use File;
910
use Folder;
@@ -20,8 +21,13 @@ class Cache {
2021

2122
protected function __construct($kirby) {
2223
$this->kirby = $kirby;
23-
$this->cacheRoot = $kirby->roots()->thumbs();
24-
$this->driver = new FileCache($this->cacheRoot);
24+
$this->cacheRoot = $kirby->roots()->thumbs();
25+
26+
try {
27+
$this->driver = new FileCache($this->cacheRoot);
28+
} catch(Error $e) {
29+
throw new Error('The thumbs directory does not exist.', $e->getCode());
30+
}
2531
}
2632

2733
public static function instance($kirby = null) {

0 commit comments

Comments
 (0)