From b39a118bba7a454fc99a5bfac37a007f0a003866 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 28 Oct 2025 17:37:22 +1300 Subject: [PATCH] Clean up errors --- src/Appwrite/Platform/Workers/Migrations.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index a532517c97..da7b180926 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -231,10 +231,6 @@ class Migrations extends Action */ protected function updateMigrationDocument(Document $migration, Document $project, Realtime $queueForRealtime): Document { - $errors = $migration->getAttribute('errors', []); - $errors = $this->sanitizeErrors($errors, []); - $migration->setAttribute('errors', $errors); - $queueForRealtime ->setProject($project) ->setSubscribers(['console', $project->getId()]) @@ -353,10 +349,7 @@ class Migrations extends Action if (!empty($sourceErrors) || ! empty($destinationErrors)) { $migration->setAttribute('status', 'failed'); $migration->setAttribute('stage', 'finished'); - - $errors = $this->sanitizeErrors($sourceErrors, $destinationErrors); - - $migration->setAttribute('errors', $errors); + $migration->setAttribute('errors', $this->sanitizeErrors($sourceErrors, $destinationErrors)); return; } @@ -382,9 +375,7 @@ class Migrations extends Action if ($transfer) { $sourceErrors = $source->getErrors(); $destinationErrors = $destination->getErrors(); - $errors = $this->sanitizeErrors($sourceErrors, $destinationErrors); - - $migration->setAttribute('errors', $errors); + $migration->setAttribute('errors', $this->sanitizeErrors($sourceErrors, $destinationErrors)); } } finally { $this->updateMigrationDocument($migration, $project, $queueForRealtime); @@ -462,11 +453,12 @@ class Migrations extends Action try { $this->deviceForFiles->delete($path); } finally { - $message = "Export file size {$sizeMB}MB exceeds your plan limit."; - $this->dbForProject->updateDocument('migrations', $migration->getId(), $migration->setAttribute( 'errors', - $message, + [ + 'code' => 0, + 'message' => "Export file size {$sizeMB}MB exceeds your plan limit.", + ], Document::SET_TYPE_APPEND, ));