1111use Imahmood \FileStorage \Contracts \MediaAwareInterface ;
1212use Imahmood \FileStorage \Contracts \MediaTypeInterface ;
1313use Imahmood \FileStorage \Exceptions \PersistenceFailedException ;
14- use Imahmood \FileStorage \Exceptions \UnableToDeleteDirectoryException ;
15- use Imahmood \FileStorage \Exceptions \UnableToDeleteFileException ;
14+ use Imahmood \FileStorage \Exceptions \DeleteDirectoryException ;
15+ use Imahmood \FileStorage \Exceptions \DeleteFileException ;
16+ use Imahmood \FileStorage \Exceptions \UploadException ;
1617use Imahmood \FileStorage \Jobs \GeneratePreview ;
1718use Imahmood \FileStorage \Jobs \OptimizeImage ;
1819use Imahmood \FileStorage \Models \Media ;
@@ -43,7 +44,7 @@ public function create(
4344
4445 /**
4546 * @throws \Imahmood\FileStorage\Exceptions\PersistenceFailedException
46- * @throws \Imahmood\FileStorage\Exceptions\UnableToDeleteFileException
47+ * @throws \Imahmood\FileStorage\Exceptions\DeleteFileException
4748 */
4849 public function update (
4950 MediaTypeInterface $ type ,
@@ -76,7 +77,7 @@ public function update(
7677 /**
7778 * @throws \InvalidArgumentException
7879 * @throws \Imahmood\FileStorage\Exceptions\PersistenceFailedException
79- * @throws \Imahmood\FileStorage\Exceptions\UnableToDeleteFileException
80+ * @throws \Imahmood\FileStorage\Exceptions\DeleteFileException
8081 */
8182 public function updateOrCreate (
8283 MediaTypeInterface $ type ,
@@ -126,7 +127,7 @@ protected function persistMedia(Media $media, ?UploadedFile $uploadedFile): Medi
126127 ]);
127128
128129 if (! $ isUploaded ) {
129- throw new PersistenceFailedException ();
130+ throw new UploadException ();
130131 }
131132
132133 if ($ media ->is_image ) {
@@ -144,7 +145,7 @@ protected function persistMedia(Media $media, ?UploadedFile $uploadedFile): Medi
144145 }
145146
146147 /**
147- * @throws \Imahmood\FileStorage\Exceptions\UnableToDeleteDirectoryException
148+ * @throws \Imahmood\FileStorage\Exceptions\DeleteDirectoryException
148149 */
149150 public function delete (Media $ media ): bool
150151 {
@@ -160,13 +161,13 @@ public function delete(Media $media): bool
160161 }
161162
162163 /**
163- * @throws \Imahmood\FileStorage\Exceptions\UnableToDeleteDirectoryException
164+ * @throws \Imahmood\FileStorage\Exceptions\DeleteDirectoryException
164165 */
165166 protected function deleteDirectory (string $ dir ): void
166167 {
167168 $ isDeleted = Storage::disk ($ this ->config ->diskName )->deleteDirectory ($ dir );
168169 if (! $ isDeleted ) {
169- throw new UnableToDeleteDirectoryException (sprintf (
170+ throw new DeleteDirectoryException (sprintf (
170171 '[FileStorage] Disk: %s, Directory: %s ' ,
171172 $ this ->config ->diskName ,
172173 $ dir
@@ -175,15 +176,15 @@ protected function deleteDirectory(string $dir): void
175176 }
176177
177178 /**
178- * @throws \Imahmood\FileStorage\Exceptions\UnableToDeleteFileException
179+ * @throws \Imahmood\FileStorage\Exceptions\DeleteFileException
179180 */
180181 protected function deleteFile (array |string $ paths ): void
181182 {
182183 $ isDeleted = Storage::disk ($ this ->config ->diskName )->delete ($ paths );
183184 if (! $ isDeleted ) {
184185 $ paths = is_array ($ paths ) ? implode (', ' , $ paths ) : $ paths ;
185186
186- throw new UnableToDeleteFileException (sprintf (
187+ throw new DeleteFileException (sprintf (
187188 '[FileStorage] Disk: %s, Paths: %s ' ,
188189 $ this ->config ->diskName ,
189190 $ paths
0 commit comments