Skip to content

Commit 4557ee4

Browse files
authored
Merge pull request #253 from keboola/CFT-42-1761299120-snowflake-decommission-error
2 parents 2eae437 + 7989adb commit 4557ee4

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Keboola\TableBackendUtils\Connection\Snowflake\Exception;
6+
7+
use Doctrine\DBAL\Exception\ServerException;
8+
9+
final class AccountDecommissionedException extends ServerException
10+
{
11+
}

src/Connection/Snowflake/SnowflakeExceptionConverter.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Doctrine\DBAL\Query;
1111
use Keboola\TableBackendUtils\Connection\Exception\ConnectionException;
1212
use Keboola\TableBackendUtils\Connection\Exception\DriverException as SnowflakeDriverException;
13+
use Keboola\TableBackendUtils\Connection\Snowflake\Exception\AccountDecommissionedException;
1314
use Keboola\TableBackendUtils\Connection\Snowflake\Exception\CannotAccessObjectException;
1415
use Keboola\TableBackendUtils\Connection\Snowflake\Exception\StringTooLongException;
1516
use Keboola\TableBackendUtils\Connection\Snowflake\Exception\WarehouseTimeoutReached;
@@ -35,6 +36,20 @@ public function convert(Exception $exception, ?Query $query): DriverException
3536
);
3637
}
3738

39+
$pattern = '/This account has been marked for decommission/';
40+
if (preg_match($pattern, $exception->getMessage())) {
41+
return new AccountDecommissionedException(
42+
new SnowflakeDriverException(
43+
'Snowflake account is marked for decommission. ' .
44+
'Please contact your administrator or update the component configuration to use an active account.',
45+
null,
46+
$exception->getCode(),
47+
$exception,
48+
),
49+
$query,
50+
);
51+
}
52+
3853
$pattern = "/String \'([^\']*)\' is too long and would be truncated/";
3954
$matches = null;
4055
if ($exception->getCode() === self::CODE_STRING_TRUNCATE

0 commit comments

Comments
 (0)