From 39ab136e9e5060f4bf05410e2d8222c7269dedd8 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Thu, 6 Jun 2024 16:21:34 +0900 Subject: [PATCH 1/3] Improve MigationCLI and Exception --- bin/MigrationCLI.php | 38 +++++++++++++++++++------ src/Migration/Destinations/Appwrite.php | 1 + src/Migration/Exception.php | 10 ++++++- src/Migration/Sources/Appwrite.php | 16 ++++++++++- src/Migration/Sources/Firebase.php | 5 ++++ src/Migration/Sources/NHost.php | 8 ++++++ src/Migration/Sources/Supabase.php | 3 ++ 7 files changed, 71 insertions(+), 10 deletions(-) diff --git a/bin/MigrationCLI.php b/bin/MigrationCLI.php index 891b92b..d5cfcf0 100644 --- a/bin/MigrationCLI.php +++ b/bin/MigrationCLI.php @@ -14,6 +14,9 @@ class MigrationCLI { protected Transfer $transfer; + protected Appwrite $source; + protected DestinationsAppwrite $destination; + /** * Prints the current status of migrations as a table after wiping the screen */ @@ -24,10 +27,29 @@ public function drawFrame() $statusCounters = $this->transfer->getStatusCounters(); $mask = "| %15.15s | %-7.7s | %10.10s | %7.7s | %7.7s | %8.8s |\n"; - printf($mask, 'Resource', 'Pending', 'Processing', 'Skipped', 'Warning', 'Success'); - printf($mask, '-------------', '-------------', '-------------', '-------------', '-------------', '-------------'); + printf($mask, 'Resource', 'Pending', 'Processing', 'Skipped', 'Warning', 'Error', 'Success'); + printf($mask, '-------------', '-------------', '-------------', '-------------', '-------------', '-------------', '-------------'); foreach ($statusCounters as $resource => $data) { - printf($mask, $resource, $data['pending'], $data['processing'], $data['skip'], $data['warning'], $data['success']); + printf($mask, $resource, $data['pending'], $data['processing'], $data['skip'], $data['warning'], $data['error'], $data['success']); + } + + // Render Errors + $destErrors = $this->destination->getErrors(); + if (!empty($destErrors)) { + echo "\n\nDestination Errors:\n"; + foreach ($destErrors as $error) { + /** @var Utopia\Migration\Exception $error */ + echo $error->getResourceName() . "[".$error->getResourceId()."] - ".$error->getMessage()."\n"; + } + } + + $sourceErrors = $this->source->getErrors(); + if (!empty($sourceErrors)) { + echo "\n\nSource Errors:\n"; + foreach ($sourceErrors as $error) { + /** @var Utopia\Migration\Exception $error */ + echo $error->getResourceType() . "[".$error->getResourceId()."] - ".$error->getMessage()."\n"; + } } } @@ -39,7 +61,7 @@ public function start() /** * Initialise All Source Adapters */ - $source = new Appwrite( + $this->source = new Appwrite( $_ENV['SOURCE_APPWRITE_TEST_PROJECT'], $_ENV['SOURCE_APPWRITE_TEST_ENDPOINT'], $_ENV['SOURCE_APPWRITE_TEST_KEY'] @@ -47,7 +69,7 @@ public function start() // $source->report(); - $destination = new DestinationsAppwrite( + $this->destination = new DestinationsAppwrite( $_ENV['DESTINATION_APPWRITE_TEST_PROJECT'], $_ENV['DESTINATION_APPWRITE_TEST_ENDPOINT'], $_ENV['DESTINATION_APPWRITE_TEST_KEY'] @@ -57,15 +79,15 @@ public function start() * Initialise Transfer Class */ $this->transfer = new Transfer( - $source, - $destination + $this->source, + $this->destination ); /** * Run Transfer */ $this->transfer->run( - $source->getSupportedResources(), + $this->source->getSupportedResources(), function (array $resources) { $this->drawFrame(); } diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index 9ef746b..203359b 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -238,6 +238,7 @@ protected function import(array $resources, callable $callback): void } else { $resource->setStatus(Resource::STATUS_ERROR, $e->getMessage()); $this->addError(new Exception( + resourceName: $resource->getName(), resourceType: $resource->getGroup(), resourceId: $resource->getId(), message: $e->getMessage(), diff --git a/src/Migration/Exception.php b/src/Migration/Exception.php index d90f50c..5b2979b 100644 --- a/src/Migration/Exception.php +++ b/src/Migration/Exception.php @@ -4,18 +4,26 @@ class Exception extends \Exception { + public string $resourceName; + public string $resourceType; public string $resourceId; - public function __construct(string $resourceType, string $message, int $code = 0, ?\Throwable $previous = null, string $resourceId = '') + public function __construct(string $resourceName, string $resourceType, string $message, int $code = 0, ?\Throwable $previous = null, string $resourceId = '') { + $this->resourceName = $resourceName; $this->resourceId = $resourceId; $this->resourceType = $resourceType; parent::__construct($message, $code, $previous); } + public function getResourceName(): string + { + return $this->resourceName; + } + public function getResourceType(): string { return $this->resourceType; diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index b44f53b..c03f045 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -281,6 +281,7 @@ protected function exportGroupAuth(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_USER, + Transfer::GROUP_AUTH, $e->getMessage() )); } @@ -292,6 +293,7 @@ protected function exportGroupAuth(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_TEAM, + Transfer::GROUP_AUTH, $e->getMessage() )); } @@ -303,6 +305,7 @@ protected function exportGroupAuth(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_MEMBERSHIP, + Transfer::GROUP_AUTH, $e->getMessage() )); } @@ -460,6 +463,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_DATABASE, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -473,6 +477,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_COLLECTION, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -486,6 +491,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_ATTRIBUTE, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -499,6 +505,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_INDEX, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -512,6 +519,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_DOCUMENT, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -972,6 +980,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_BUCKET, + Transfer::GROUP_STORAGE, $e->getMessage() ) ); @@ -985,6 +994,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_FILE, + Transfer::GROUP_STORAGE, $e->getMessage() ) ); @@ -998,6 +1008,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_BUCKET, + Transfer::GROUP_STORAGE, $e->getMessage() ) ); @@ -1072,7 +1083,8 @@ private function exportFiles(int $batchSize) )); } catch (\Throwable $e) { $this->addError(new Exception( - resourceType: Resource::TYPE_FILE, + resourceName: Resource::TYPE_FILE, + resourceType: Transfer::GROUP_STORAGE, message: $e->getMessage(), code: $e->getCode(), resourceId: $file['$id'] @@ -1136,6 +1148,7 @@ protected function exportGroupFunctions(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_FUNCTION, + Transfer::GROUP_FUNCTIONS, $e->getMessage() )); } @@ -1147,6 +1160,7 @@ protected function exportGroupFunctions(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_DEPLOYMENT, + Transfer::GROUP_FUNCTIONS, $e->getMessage() )); } diff --git a/src/Migration/Sources/Firebase.php b/src/Migration/Sources/Firebase.php index 3effe6e..2082bb2 100644 --- a/src/Migration/Sources/Firebase.php +++ b/src/Migration/Sources/Firebase.php @@ -172,6 +172,7 @@ protected function exportGroupAuth(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_USER, + Transfer::GROUP_AUTH, $e->getMessage() ) ); @@ -284,6 +285,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_DATABASE, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -297,6 +299,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_COLLECTION, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -555,6 +558,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_BUCKET, + Transfer::GROUP_STORAGE, $e->getMessage() )); } @@ -566,6 +570,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_FILE, + Transfer::GROUP_STORAGE, $e->getMessage() )); } diff --git a/src/Migration/Sources/NHost.php b/src/Migration/Sources/NHost.php index 2671354..fb689ae 100644 --- a/src/Migration/Sources/NHost.php +++ b/src/Migration/Sources/NHost.php @@ -219,6 +219,7 @@ protected function exportGroupAuth(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_USER, + Transfer::GROUP_AUTH, $e->getMessage() )); } @@ -275,6 +276,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_DATABASE, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -288,6 +290,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_COLLECTION, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -301,6 +304,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_ATTRIBUTE, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -314,6 +318,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_DOCUMENT, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -327,6 +332,7 @@ protected function exportGroupDatabases(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_INDEX, + Transfer::GROUP_DATABASES, $e->getMessage() ) ); @@ -619,6 +625,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_BUCKET, + Transfer::GROUP_STORAGE, $e->getMessage() ) ); @@ -632,6 +639,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError( new Exception( Resource::TYPE_FILE, + Transfer::GROUP_STORAGE, $e->getMessage() ) ); diff --git a/src/Migration/Sources/Supabase.php b/src/Migration/Sources/Supabase.php index 32397f1..e58ac1d 100644 --- a/src/Migration/Sources/Supabase.php +++ b/src/Migration/Sources/Supabase.php @@ -355,6 +355,7 @@ protected function exportGroupAuth(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_BUCKET, + Transfer::GROUP_STORAGE, $e->getMessage() )); } @@ -438,6 +439,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_BUCKET, + Transfer::GROUP_STORAGE, $e->getMessage() )); } @@ -449,6 +451,7 @@ protected function exportGroupStorage(int $batchSize, array $resources) } catch (\Throwable $e) { $this->addError(new Exception( Resource::TYPE_BUCKET, + Transfer::GROUP_STORAGE, $e->getMessage() )); } From 0411eb4e0c5966fccea548b29e5a0409a17678a1 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Thu, 6 Jun 2024 16:27:31 +0900 Subject: [PATCH 2/3] Run Linter --- bin/MigrationCLI.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/MigrationCLI.php b/bin/MigrationCLI.php index d5cfcf0..cbd9e68 100644 --- a/bin/MigrationCLI.php +++ b/bin/MigrationCLI.php @@ -15,6 +15,7 @@ class MigrationCLI protected Transfer $transfer; protected Appwrite $source; + protected DestinationsAppwrite $destination; /** @@ -35,20 +36,20 @@ public function drawFrame() // Render Errors $destErrors = $this->destination->getErrors(); - if (!empty($destErrors)) { + if (! empty($destErrors)) { echo "\n\nDestination Errors:\n"; foreach ($destErrors as $error) { /** @var Utopia\Migration\Exception $error */ - echo $error->getResourceName() . "[".$error->getResourceId()."] - ".$error->getMessage()."\n"; + echo $error->getResourceName().'['.$error->getResourceId().'] - '.$error->getMessage()."\n"; } } $sourceErrors = $this->source->getErrors(); - if (!empty($sourceErrors)) { + if (! empty($sourceErrors)) { echo "\n\nSource Errors:\n"; foreach ($sourceErrors as $error) { /** @var Utopia\Migration\Exception $error */ - echo $error->getResourceType() . "[".$error->getResourceId()."] - ".$error->getMessage()."\n"; + echo $error->getResourceType().'['.$error->getResourceId().'] - '.$error->getMessage()."\n"; } } } From 65bd29da8b5b040ea090c54473b997cc0f0740cd Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Thu, 13 Jun 2024 15:43:44 +0900 Subject: [PATCH 3/3] Pass more data to the exception --- src/Migration/Destinations/Appwrite.php | 5 ++- src/Migration/Exception.php | 10 ++--- src/Migration/Sources/Appwrite.php | 54 ++++++++++++++++++------- src/Migration/Sources/Firebase.php | 20 ++++++--- src/Migration/Sources/NHost.php | 32 +++++++++++---- src/Migration/Sources/Supabase.php | 12 ++++-- 6 files changed, 96 insertions(+), 37 deletions(-) diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index 203359b..d29f801 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -239,10 +239,11 @@ protected function import(array $resources, callable $callback): void $resource->setStatus(Resource::STATUS_ERROR, $e->getMessage()); $this->addError(new Exception( resourceName: $resource->getName(), - resourceType: $resource->getGroup(), + resourceGroup: $resource->getGroup(), resourceId: $resource->getId(), message: $e->getMessage(), - code: $e->getCode() + code: $e->getCode(), + previous: $e )); } diff --git a/src/Migration/Exception.php b/src/Migration/Exception.php index 5b2979b..46ecf52 100644 --- a/src/Migration/Exception.php +++ b/src/Migration/Exception.php @@ -6,15 +6,15 @@ class Exception extends \Exception { public string $resourceName; - public string $resourceType; + public string $resourceGroup; public string $resourceId; - public function __construct(string $resourceName, string $resourceType, string $message, int $code = 0, ?\Throwable $previous = null, string $resourceId = '') + public function __construct(string $resourceName, string $resourceGroup, string $message, int $code = 0, ?\Throwable $previous = null, string $resourceId = '') { $this->resourceName = $resourceName; $this->resourceId = $resourceId; - $this->resourceType = $resourceType; + $this->resourceGroup = $resourceGroup; parent::__construct($message, $code, $previous); } @@ -24,9 +24,9 @@ public function getResourceName(): string return $this->resourceName; } - public function getResourceType(): string + public function getResourceGroup(): string { - return $this->resourceType; + return $this->resourceGroup; } public function getResourceId(): string diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index c03f045..f66e344 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -282,7 +282,9 @@ protected function exportGroupAuth(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_USER, Transfer::GROUP_AUTH, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } @@ -294,7 +296,9 @@ protected function exportGroupAuth(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_TEAM, Transfer::GROUP_AUTH, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } @@ -306,7 +310,9 @@ protected function exportGroupAuth(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_MEMBERSHIP, Transfer::GROUP_AUTH, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } } @@ -464,7 +470,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_DATABASE, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -478,7 +486,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_COLLECTION, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -492,7 +502,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_ATTRIBUTE, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -506,7 +518,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_INDEX, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -520,7 +534,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_DOCUMENT, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -981,7 +997,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) new Exception( Resource::TYPE_BUCKET, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -995,7 +1013,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) new Exception( Resource::TYPE_FILE, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -1009,7 +1029,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) new Exception( Resource::TYPE_BUCKET, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -1084,7 +1106,7 @@ private function exportFiles(int $batchSize) } catch (\Throwable $e) { $this->addError(new Exception( resourceName: Resource::TYPE_FILE, - resourceType: Transfer::GROUP_STORAGE, + resourceGroup: Transfer::GROUP_STORAGE, message: $e->getMessage(), code: $e->getCode(), resourceId: $file['$id'] @@ -1149,7 +1171,9 @@ protected function exportGroupFunctions(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_FUNCTION, Transfer::GROUP_FUNCTIONS, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } @@ -1161,7 +1185,9 @@ protected function exportGroupFunctions(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_DEPLOYMENT, Transfer::GROUP_FUNCTIONS, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } } diff --git a/src/Migration/Sources/Firebase.php b/src/Migration/Sources/Firebase.php index 2082bb2..2735201 100644 --- a/src/Migration/Sources/Firebase.php +++ b/src/Migration/Sources/Firebase.php @@ -173,7 +173,9 @@ protected function exportGroupAuth(int $batchSize, array $resources) new Exception( Resource::TYPE_USER, Transfer::GROUP_AUTH, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -286,7 +288,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_DATABASE, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -300,7 +304,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_COLLECTION, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -559,7 +565,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_BUCKET, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } @@ -571,7 +579,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_FILE, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } diff --git a/src/Migration/Sources/NHost.php b/src/Migration/Sources/NHost.php index fb689ae..9162adb 100644 --- a/src/Migration/Sources/NHost.php +++ b/src/Migration/Sources/NHost.php @@ -220,7 +220,9 @@ protected function exportGroupAuth(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_USER, Transfer::GROUP_AUTH, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } } @@ -277,7 +279,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_DATABASE, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -291,7 +295,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_COLLECTION, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -305,7 +311,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_ATTRIBUTE, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -319,7 +327,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_DOCUMENT, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -333,7 +343,9 @@ protected function exportGroupDatabases(int $batchSize, array $resources) new Exception( Resource::TYPE_INDEX, Transfer::GROUP_DATABASES, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -626,7 +638,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) new Exception( Resource::TYPE_BUCKET, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } @@ -640,7 +654,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) new Exception( Resource::TYPE_FILE, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e ) ); } diff --git a/src/Migration/Sources/Supabase.php b/src/Migration/Sources/Supabase.php index e58ac1d..c92664c 100644 --- a/src/Migration/Sources/Supabase.php +++ b/src/Migration/Sources/Supabase.php @@ -356,7 +356,9 @@ protected function exportGroupAuth(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_BUCKET, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } } @@ -440,7 +442,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_BUCKET, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } @@ -452,7 +456,9 @@ protected function exportGroupStorage(int $batchSize, array $resources) $this->addError(new Exception( Resource::TYPE_BUCKET, Transfer::GROUP_STORAGE, - $e->getMessage() + $e->getMessage(), + $e->getCode(), + $e )); } }