Skip to content

Commit b0867d9

Browse files
committed
Handle HTTP exceptions in HttpTransport
Signed-off-by: Kim Pepper <[email protected]>
1 parent 274adf2 commit b0867d9

40 files changed

+566
-172
lines changed

src/OpenSearch/Common/Exceptions/Forbidden403Exception.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
@trigger_error(Forbidden403Exception::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0.', E_USER_DEPRECATED);
24+
use OpenSearch\Exception\ForbiddenHttpException;
25+
26+
@trigger_error(Forbidden403Exception::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0. Use \OpenSearch\Exception\ForbiddenHttpException instead', E_USER_DEPRECATED);
2527

2628
/**
2729
* @deprecated in 2.3.2 and will be removed in 3.0.0.
30+
*
31+
* @see \OpenSearch\Exception\ForbiddenHttpException
2832
*/
29-
class Forbidden403Exception extends \Exception implements OpenSearchException
33+
class Forbidden403Exception extends ForbiddenHttpException
3034
{
3135
}

src/OpenSearch/Common/Exceptions/Missing404Exception.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
@trigger_error(Missing404Exception::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0.', E_USER_DEPRECATED);
24+
use OpenSearch\Exception\NotFoundHttpException;
25+
26+
@trigger_error(
27+
Missing404Exception::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0. Use \OpenSearch\Exception\NotFoundHttpException instead.',
28+
E_USER_DEPRECATED
29+
);
2530

2631
/**
2732
* @deprecated in 2.3.2 and will be removed in 3.0.0.
33+
*
34+
* @see \OpenSearch\Exception\NotFoundHttpException
2835
*/
29-
class Missing404Exception extends \Exception implements OpenSearchException
36+
class Missing404Exception extends NotFoundHttpException
3037
{
3138
}

src/OpenSearch/Common/Exceptions/NoDocumentsToGetException.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
@trigger_error(NoDocumentsToGetException::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0.', E_USER_DEPRECATED);
24+
@trigger_error(
25+
NoDocumentsToGetException::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0. Use \OpenSearch\Exception\NoDocumentsToGetException instead.',
26+
E_USER_DEPRECATED
27+
);
2528

2629
/**
27-
* @deprecated in 2.3.2 and will be removed in 3.0.0.
30+
* @deprecated in 2.3.2 and will be removed in 3.0.0. Use \OpenSearch\Exception\NoDocumentsToGetException instead.
31+
*
32+
* @see \OpenSearch\Exception\ScriptLangNotSupportedException
2833
*/
29-
class NoDocumentsToGetException extends ServerErrorResponseException implements OpenSearchException
34+
class NoDocumentsToGetException extends \OpenSearch\Exception\NoDocumentsToGetException
3035
{
3136
}

src/OpenSearch/Common/Exceptions/NoNodesAvailableException.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24+
@trigger_error(
25+
NoNodesAvailableException::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0.',
26+
E_USER_DEPRECATED
27+
);
28+
29+
/**
30+
* @deprecated in 2.3.2 and will be removed in 3.0.0.
31+
*/
2432
class NoNodesAvailableException extends ServerErrorResponseException implements OpenSearchException
2533
{
2634
}

src/OpenSearch/Common/Exceptions/NoShardAvailableException.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
class NoShardAvailableException extends ServerErrorResponseException implements OpenSearchException
24+
@trigger_error(
25+
NoShardAvailableException::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0. Use \OpenSearch\Exception\NoShardAvailableException instead.',
26+
E_USER_DEPRECATED
27+
);
28+
29+
/**
30+
* @deprecated in 2.3.2 and will be removed in 3.0.0. Use \OpenSearch\Exception\NoShardAvailableException instead.
31+
*
32+
* @see \OpenSearch\Exception\NoShardAvailableException
33+
*/
34+
class NoShardAvailableException extends \OpenSearch\Exception\NoShardAvailableException
2535
{
2636
}

src/OpenSearch/Common/Exceptions/OpenSearchException.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
use Throwable;
24+
use OpenSearch\Exception\OpenSearchExceptionInterface;
2525

26-
interface OpenSearchException extends Throwable
26+
@trigger_error(
27+
NoNodesAvailableException::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0.',
28+
E_USER_DEPRECATED
29+
);
30+
31+
/**
32+
* @deprecated in 2.3.2 and will be removed in 3.0.0.
33+
*/
34+
interface OpenSearchException extends OpenSearchExceptionInterface
2735
{
2836
}

src/OpenSearch/Common/Exceptions/RoutingMissingException.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
class RoutingMissingException extends ServerErrorResponseException implements OpenSearchException
24+
@trigger_error(
25+
RoutingMissingException::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0. Use \OpenSearch\Exception\RoutingMissingException instead.',
26+
E_USER_DEPRECATED
27+
);
28+
29+
/**
30+
* @deprecated in 2.3.2 and will be removed in 3.0.0. Use OpenSearch\Exception\UnauthorizedHttpException instead.
31+
*
32+
* @see \OpenSearch\Exception\ScriptLangNotSupportedException
33+
*/
34+
class RoutingMissingException extends \OpenSearch\Exception\RoutingMissingException
2535
{
2636
}

src/OpenSearch/Common/Exceptions/RuntimeException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
class RuntimeException extends \RuntimeException implements OpenSearchException
24+
use OpenSearch\Exception\OpenSearchExceptionInterface;
25+
26+
class RuntimeException extends \RuntimeException implements OpenSearchExceptionInterface
2527
{
2628
}

src/OpenSearch/Common/Exceptions/ScriptLangNotSupportedException.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24-
class ScriptLangNotSupportedException extends BadRequest400Exception implements OpenSearchException
24+
@trigger_error(
25+
ScriptLangNotSupportedException::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0. Use OpenSearch\Exception\ScriptLangNotSupportedException instead.',
26+
E_USER_DEPRECATED
27+
);
28+
29+
/**
30+
* @deprecated in 2.3.2 and will be removed in 3.0.0. Use OpenSearch\Exception\UnauthorizedHttpException instead.
31+
*
32+
* @see \OpenSearch\Exception\ScriptLangNotSupportedException
33+
*/
34+
class ScriptLangNotSupportedException extends \OpenSearch\Exception\ScriptLangNotSupportedException
2535
{
2636
}

src/OpenSearch/Common/Exceptions/ServerErrorResponseException.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
namespace OpenSearch\Common\Exceptions;
2323

24+
@trigger_error(RequestTimeout408Exception::class . ' is deprecated in 2.3.2 and will be removed in 3.0.0.', E_USER_DEPRECATED);
25+
26+
/**
27+
* @deprecated in 2.3.2 and will be removed in 3.0.0.
28+
*/
2429
class ServerErrorResponseException extends TransportException implements OpenSearchException
2530
{
2631
}

0 commit comments

Comments
 (0)