From e060244b01d296f97668f2705627ca38ce3b61f7 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Tue, 5 May 2026 15:46:26 +0100 Subject: [PATCH] Stop createField/createIndex cleanup catches from silencing bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The catch (\Throwable) cleanup blocks in createField and createIndex were rewrapping any thrown exception as a Migration\Exception with a generic 'Failed to create column/index' message. With the worker's instanceof MigrationException gate, this silenced real library bugs (TypeError, RuntimeException, PDOException) from Sentry — the exact opposite of what the surrounding PR aims to do. Rethrow the original cause instead, so the safety net at import() records the real message for the user and the worker boundary routes non-MigrationException throwables to Sentry with full trace. --- src/Migration/Destinations/Appwrite.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index e7e4fc535a..846669cb86 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -821,19 +821,14 @@ class Appwrite extends Destination throw new \Exception('Failed to create Column', Exception::CODE_INTERNAL); } } - } catch (\Throwable) { + } catch (\Throwable $e) { $this->dbForProject->deleteDocument('attributes', $column->getId()); if (isset($twoWayAttribute)) { $this->dbForProject->deleteDocument('attributes', $twoWayAttribute->getId()); } - throw new Exception( - resourceName: $resource->getName(), - resourceGroup: $resource->getGroup(), - resourceId: $resource->getId(), - message: 'Failed to create column', - ); + throw $e; } if ($type === UtopiaDatabase::VAR_RELATIONSHIP && $options['twoWay']) { @@ -986,12 +981,7 @@ class Appwrite extends Destination } catch (\Throwable $th) { $this->dbForProject->deleteDocument('indexes', $index->getId()); - throw new Exception( - resourceName: $resource->getName(), - resourceGroup: $resource->getGroup(), - resourceId: $resource->getId(), - message: 'Failed to create index', - ); + throw $th; } $this->dbForProject->purgeCachedDocument(