diff --git a/src/Bkwld/Croppa/Storage.php b/src/Bkwld/Croppa/Storage.php index e6c0c85..b826fb2 100644 --- a/src/Bkwld/Croppa/Storage.php +++ b/src/Bkwld/Croppa/Storage.php @@ -1,8 +1,9 @@ src_disk->has($path)) return $this->src_disk->read($path); - else throw new NotFoundHttpException('Croppa: Referenced file missing'); + else throw new NotFoundHttpException('Croppa: Src image is missing'); } /** @@ -146,10 +147,18 @@ public function readSrc($path) { * * @param string $path Where to save the crop * @param string $contents The image data - * @param void + * @throws Exception + * @return void */ public function writeCrop($path, $contents) { - $this->crops_disk->write($path, $contents); + try { + $this->crops_disk->write($path, $contents); + } catch(FileExistsException $e) { + throw new Exception("Croppa: Crop already exists at $path. You probably + have a misconfiguration. Make sure that the URL to your crop can be + transformed by the `path` config to your `crop_dir`."); + } + } /**