From 437d00ec747533f15a81e2b41b73f7059916aa2e Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 20 Feb 2024 09:04:53 +0000 Subject: [PATCH] Update Migrations.php --- src/Appwrite/Platform/Workers/Migrations.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index d2a126f22b..8f2847bbec 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -285,15 +285,19 @@ class Migrations extends Action $this->updateMigrationDocument($migrationDocument, $projectDocument); }); - $errors = $transfer->getReport(Resource::STATUS_ERROR); + $sourceErrors = $source->getErrors(); + $destinationErrors = $destination->getErrors(); - if (count($errors) > 0) { + if (count($sourceErrors) > 0 || count($destinationErrors) > 0) { $migrationDocument->setAttribute('status', 'failed'); $migrationDocument->setAttribute('stage', 'finished'); $errorMessages = []; - foreach ($errors as $error) { - $errorMessages[] = "Failed to transfer resource '{$error['id']}:{$error['resource']}' with message '{$error['message']}'"; + foreach ($sourceErrors as $error) { + $errorMessages[] = "[Source] Failed to transfer resource '{$error->getResourceId()}:{$error->getResourceType()}' with message '{$error->getMessage()}'"; + } + foreach ($destinationErrors as $error) { + $errorMessages[] = "[Destination] Failed to transfer resource '{$error->getResourceId()}:{$error->getResourceType()}' with message '{$error->getMessage()}'"; } $migrationDocument->setAttribute('errors', $errorMessages);