Skip to content

Commit f901fce

Browse files
author
Mohamed Khaled
committed
Implement usage-driven exception hierarchy with custom classes
1 parent c1aede5 commit f901fce

File tree

6 files changed

+3
-12
lines changed

6 files changed

+3
-12
lines changed

src/Files/DTO/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace WordPress\AiClient\Files\DTO;
66

7+
use WordPress\AiClient\Common\AbstractDataTransferObject;
78
use WordPress\AiClient\Common\Exception\InvalidArgumentException;
89
use WordPress\AiClient\Common\Exception\RuntimeException;
9-
use WordPress\AiClient\Common\AbstractDataTransferObject;
1010
use WordPress\AiClient\Files\Enums\FileTypeEnum;
1111
use WordPress\AiClient\Files\ValueObjects\MimeType;
1212

src/Providers/Http/DTO/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace WordPress\AiClient\Providers\Http\DTO;
66

7-
use WordPress\AiClient\Common\Exception\InvalidArgumentException;
87
use JsonException;
98
use WordPress\AiClient\Common\AbstractDataTransferObject;
9+
use WordPress\AiClient\Common\Exception\InvalidArgumentException;
1010
use WordPress\AiClient\Providers\Http\Collections\HeadersCollection;
1111
use WordPress\AiClient\Providers\Http\Enums\HttpMethodEnum;
1212

src/Providers/Http/DTO/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace WordPress\AiClient\Providers\Http\DTO;
66

7-
use WordPress\AiClient\Common\Exception\InvalidArgumentException;
87
use WordPress\AiClient\Common\AbstractDataTransferObject;
8+
use WordPress\AiClient\Common\Exception\InvalidArgumentException;
99
use WordPress\AiClient\Providers\Http\Collections\HeadersCollection;
1010

1111
/**

src/Providers/Http/Exception/NetworkException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*/
1717
class NetworkException extends RuntimeException
1818
{
19-
20-
2119
/**
2220
* Creates a NetworkException from a PSR-18 network exception.
2321
*
@@ -37,6 +35,4 @@ public static function fromPsr18NetworkException(string $uri, \Throwable $networ
3735

3836
return new self($message, 0, $networkException);
3937
}
40-
41-
4238
}

src/Providers/Http/Exception/RequestException.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace WordPress\AiClient\Providers\Http\Exception;
66

77
use WordPress\AiClient\Common\Exception\InvalidArgumentException;
8-
use WordPress\AiClient\Providers\Http\DTO\Response;
98

109
/**
1110
* Exception thrown for AI API request errors due to bad request data.
@@ -18,8 +17,6 @@
1817
*/
1918
class RequestException extends InvalidArgumentException
2019
{
21-
22-
2320
/**
2421
* Creates a RequestException from a bad request to a specific URI.
2522
*

src/Providers/Http/Exception/ResponseException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,4 @@ public static function fromBadResponse(Response $response): self
8484

8585
return new self($errorMessage, $response->getStatusCode());
8686
}
87-
88-
8987
}

0 commit comments

Comments
 (0)