Stop createField/createIndex cleanup catches from silencing bugs

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.
This commit is contained in:
Prem Palanisamy committed 2026-05-05 15:46:26 +01:00
1 parent 7bb1da14e1
commit e060244b01
1 file changed
+3 -13
+3 -13
View File
@@ -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(