File tree Expand file tree Collapse file tree 5 files changed +7
-18
lines changed Expand file tree Collapse file tree 5 files changed +7
-18
lines changed Original file line number Diff line number Diff line change 2727use League \Flysystem \UrlGeneration \PublicUrlGenerator ;
2828use League \Flysystem \Visibility ;
2929use League \MimeTypeDetection \FinfoMimeTypeDetector ;
30+ use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
3031use RuntimeException ;
3132use TypeError ;
3233
@@ -252,6 +253,8 @@ public function deleteDirectory(string $path): void
252253 rtrim ($ path , '/ ' ).'/ '
253254 );
254255 // @codeCoverageIgnoreStart
256+ } catch (NotFoundException ) {
257+ // nth
255258 } catch (Exceptions \BunnyCDNException $ e ) {
256259 throw UnableToDeleteDirectory::atLocation ($ path , $ e ->getMessage ());
257260 }
@@ -462,10 +465,10 @@ public function delete($path): void
462465 try {
463466 $ this ->client ->delete ($ path );
464467 // @codeCoverageIgnoreStart
468+ } catch (NotFoundException ) {
469+ // nth
465470 } catch (Exceptions \BunnyCDNException $ e ) {
466- if (! str_contains ($ e ->getMessage (), '404 ' )) { // Urgh
467- throw UnableToDeleteFile::atLocation ($ path , $ e ->getMessage ());
468- }
471+ throw UnableToDeleteFile::atLocation ($ path , $ e ->getMessage ());
469472 }
470473 // @codeCoverageIgnoreEnd
471474 }
Original file line number Diff line number Diff line change 55use GuzzleHttp \Client as Guzzle ;
66use GuzzleHttp \Exception \GuzzleException ;
77use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \BunnyCDNException ;
8- use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \DirectoryNotEmptyException ;
98use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
109
1110class BunnyCDNClient
@@ -204,7 +203,7 @@ public function make_directory(string $path): mixed
204203 * @return mixed
205204 *
206205 * @throws NotFoundException
207- * @throws DirectoryNotEmptyException| BunnyCDNException
206+ * @throws BunnyCDNException
208207 */
209208 public function delete (string $ path ): mixed
210209 {
@@ -214,7 +213,6 @@ public function delete(string $path): mixed
214213 } catch (GuzzleException $ e ) {
215214 throw match ($ e ->getCode ()) {
216215 404 => new NotFoundException ($ e ->getMessage ()),
217- 400 => new DirectoryNotEmptyException ($ e ->getMessage ()),
218216 default => new BunnyCDNException ($ e ->getMessage ())
219217 };
220218 }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 77use PlatformCommunity \Flysystem \BunnyCDN \BunnyCDNClient ;
88use PlatformCommunity \Flysystem \BunnyCDN \BunnyCDNRegion ;
99use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \BunnyCDNException ;
10- use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \DirectoryNotEmptyException ;
1110use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
1211
1312if (\is_file (__DIR__ .'/ClientDI.php ' )) {
@@ -167,7 +166,6 @@ public function test_make_directory()
167166 * @return void
168167 *
169168 * @throws BunnyCDNException
170- * @throws DirectoryNotEmptyException
171169 * @throws NotFoundException
172170 */
173171 public function test_delete_file ()
@@ -187,7 +185,6 @@ public function test_delete_file()
187185 * @return void
188186 *
189187 * @throws BunnyCDNException
190- * @throws DirectoryNotEmptyException
191188 * @throws NotFoundException
192189 */
193190 public function test_delete_file_not_found ()
Original file line number Diff line number Diff line change 1010use League \Flysystem \StorageAttributes ;
1111use PlatformCommunity \Flysystem \BunnyCDN \BunnyCDNClient ;
1212use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \BunnyCDNException ;
13- use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \DirectoryNotEmptyException ;
1413use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
1514use PlatformCommunity \Flysystem \BunnyCDN \Util ;
1615
@@ -109,7 +108,6 @@ public function make_directory(string $path): array
109108 *
110109 * @throws FilesystemException
111110 * @throws BunnyCDNException
112- * @throws DirectoryNotEmptyException
113111 * @throws NotFoundException
114112 */
115113 public function delete (string $ path ): array
You can’t perform that action at this time.
0 commit comments