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 27
27
use League \Flysystem \UrlGeneration \PublicUrlGenerator ;
28
28
use League \Flysystem \Visibility ;
29
29
use League \MimeTypeDetection \FinfoMimeTypeDetector ;
30
+ use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
30
31
use RuntimeException ;
31
32
use TypeError ;
32
33
@@ -252,6 +253,8 @@ public function deleteDirectory(string $path): void
252
253
rtrim ($ path , '/ ' ).'/ '
253
254
);
254
255
// @codeCoverageIgnoreStart
256
+ } catch (NotFoundException ) {
257
+ // nth
255
258
} catch (Exceptions \BunnyCDNException $ e ) {
256
259
throw UnableToDeleteDirectory::atLocation ($ path , $ e ->getMessage ());
257
260
}
@@ -462,10 +465,10 @@ public function delete($path): void
462
465
try {
463
466
$ this ->client ->delete ($ path );
464
467
// @codeCoverageIgnoreStart
468
+ } catch (NotFoundException ) {
469
+ // nth
465
470
} 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 ());
469
472
}
470
473
// @codeCoverageIgnoreEnd
471
474
}
Original file line number Diff line number Diff line change 5
5
use GuzzleHttp \Client as Guzzle ;
6
6
use GuzzleHttp \Exception \GuzzleException ;
7
7
use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \BunnyCDNException ;
8
- use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \DirectoryNotEmptyException ;
9
8
use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
10
9
11
10
class BunnyCDNClient
@@ -204,7 +203,7 @@ public function make_directory(string $path): mixed
204
203
* @return mixed
205
204
*
206
205
* @throws NotFoundException
207
- * @throws DirectoryNotEmptyException| BunnyCDNException
206
+ * @throws BunnyCDNException
208
207
*/
209
208
public function delete (string $ path ): mixed
210
209
{
@@ -214,7 +213,6 @@ public function delete(string $path): mixed
214
213
} catch (GuzzleException $ e ) {
215
214
throw match ($ e ->getCode ()) {
216
215
404 => new NotFoundException ($ e ->getMessage ()),
217
- 400 => new DirectoryNotEmptyException ($ e ->getMessage ()),
218
216
default => new BunnyCDNException ($ e ->getMessage ())
219
217
};
220
218
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 7
7
use PlatformCommunity \Flysystem \BunnyCDN \BunnyCDNClient ;
8
8
use PlatformCommunity \Flysystem \BunnyCDN \BunnyCDNRegion ;
9
9
use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \BunnyCDNException ;
10
- use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \DirectoryNotEmptyException ;
11
10
use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
12
11
13
12
if (\is_file (__DIR__ .'/ClientDI.php ' )) {
@@ -167,7 +166,6 @@ public function test_make_directory()
167
166
* @return void
168
167
*
169
168
* @throws BunnyCDNException
170
- * @throws DirectoryNotEmptyException
171
169
* @throws NotFoundException
172
170
*/
173
171
public function test_delete_file ()
@@ -187,7 +185,6 @@ public function test_delete_file()
187
185
* @return void
188
186
*
189
187
* @throws BunnyCDNException
190
- * @throws DirectoryNotEmptyException
191
188
* @throws NotFoundException
192
189
*/
193
190
public function test_delete_file_not_found ()
Original file line number Diff line number Diff line change 10
10
use League \Flysystem \StorageAttributes ;
11
11
use PlatformCommunity \Flysystem \BunnyCDN \BunnyCDNClient ;
12
12
use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \BunnyCDNException ;
13
- use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \DirectoryNotEmptyException ;
14
13
use PlatformCommunity \Flysystem \BunnyCDN \Exceptions \NotFoundException ;
15
14
use PlatformCommunity \Flysystem \BunnyCDN \Util ;
16
15
@@ -109,7 +108,6 @@ public function make_directory(string $path): array
109
108
*
110
109
* @throws FilesystemException
111
110
* @throws BunnyCDNException
112
- * @throws DirectoryNotEmptyException
113
111
* @throws NotFoundException
114
112
*/
115
113
public function delete (string $ path ): array
You can’t perform that action at this time.
0 commit comments