Skip to content

Commit 54e920b

Browse files
committed
Init
1 parent 05a9021 commit 54e920b

28 files changed

+439
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* added retry function
2+
13
## 1.5.5
24

35
* fixed iam auth for PHP < 8.0
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions;
4+
5+
class NonRetryableException extends \Exception
6+
{
7+
}

src/Exceptions/RetryableException.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions;
4+
5+
class RetryableException extends \Exception
6+
{
7+
/**
8+
* @var bool
9+
*/
10+
protected $fastBackoff;
11+
12+
/**
13+
* @return bool
14+
*/
15+
public function isFastBackoff(): bool
16+
{
17+
return $this->fastBackoff;
18+
}
19+
20+
}

src/Exceptions/SdkException.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
namespace YdbPlatform\Ydb\Exceptions;
3+
4+
class SdkException extends \YdbPlatform\Ydb\Exception
5+
{
6+
/**
7+
* @var string
8+
*/
9+
protected $errorCode;
10+
11+
/**
12+
* @var bool
13+
*/
14+
protected $retryable;
15+
16+
/**
17+
* @return string
18+
*/
19+
public function getErrorCode(): string
20+
{
21+
return $this->errorCode;
22+
}
23+
24+
/**
25+
* @return bool
26+
*/
27+
public function isRetryable()
28+
{
29+
return $this->retryable;
30+
}
31+
public function setErrorCode($errorCode){
32+
$this->errorCode = $errorCode;
33+
}
34+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions\Ydb;
4+
5+
use YdbPlatform\Ydb\Exceptions\RetryableException;
6+
7+
class AbortedException extends RetryableException
8+
{
9+
public function isFastBackoff(): bool
10+
{
11+
return true;
12+
}
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions\Ydb;
4+
5+
class AlreadyExistsException extends \YdbPlatform\Ydb\Exceptions\NonRetryableException
6+
{
7+
8+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions\Ydb;
4+
5+
use YdbPlatform\Ydb\Exceptions\NonRetryableException;
6+
7+
class BadRequestException extends NonRetryableException
8+
{
9+
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions\Ydb;
4+
5+
use Ydb\StatusIds\StatusCode;
6+
7+
class BadSessionException extends \YdbPlatform\Ydb\Exceptions\RetryableException
8+
{
9+
public function isFastBackoff(): bool
10+
{
11+
return true;
12+
}
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions\Ydb;
4+
5+
class CanceledException extends \YdbPlatform\Ydb\Exceptions\NonRetryableException
6+
{
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace YdbPlatform\Ydb\Exceptions\Ydb;
4+
5+
class ClientResourceExhaustedException extends \YdbPlatform\Ydb\Exceptions\NonRetryableException
6+
{
7+
8+
}

0 commit comments

Comments
 (0)