Skip to content

Commit 0f5347c

Browse files
authored
improve error handling SchemaBuilder
Extending error context : Previous: ```Warning: Undefined array key "type" in /var/www/html/magento/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 91``` Now: ```Warning: Undefined array key "type" in /var/www/html/magento/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php on line 91 Error processing table catalog_eav_attribute column is_used_in_autocomplete``` Help undersend the issue without heavy debugging!
1 parent 73d7bd4 commit 0f5347c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,22 @@ public function build(Schema $schema)
8787
if (isset($data['table'])) {
8888
foreach ($data['table'] as $keyTable => $tableColumns) {
8989
foreach ($tableColumns['column'] as $keyColumn => $columnData) {
90-
if ($columnData['type'] == 'json') {
91-
$tablesWithJsonTypeField[$keyTable] = $keyColumn;
90+
try {
91+
if ($columnData['type'] == 'json') {
92+
$tablesWithJsonTypeField[$keyTable] = $keyColumn;
93+
}
94+
} catch (\Throwable $e) {
95+
// Create a new exception with extended context message
96+
$errorMessage = sprintf(
97+
"%s\nError processing table %s column %s",
98+
$e->getMessage(),
99+
$keyTable,
100+
$keyColumn
101+
);
102+
103+
// Throw a new exception with the extended message
104+
// This preserves the original error but adds our context
105+
throw new \Exception($errorMessage, $e->getCode(), $e);
92106
}
93107
}
94108
}

0 commit comments

Comments
 (0)