From 8370ca692c3dfbcefb3bc54079e0d7bc573e18ea Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Thu, 29 May 2025 17:37:34 +0100 Subject: [PATCH] fix: add throw propagation --- .../1748492346868-v-2-2-9.migration.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/api/src/migration/migrations/1748492346868-v-2-2-9.migration.ts b/api/src/migration/migrations/1748492346868-v-2-2-9.migration.ts index 080c9e87..ad3190a7 100644 --- a/api/src/migration/migrations/1748492346868-v-2-2-9.migration.ts +++ b/api/src/migration/migrations/1748492346868-v-2-2-9.migration.ts @@ -53,9 +53,8 @@ const migrateBlockOptionsContentLimit = async (services: MigrationServices) => { } catch (error) { services.logger.error(`Failed to update limit : ${error.message}`); - return false; + throw error instanceof Error ? error : new Error(error); } - return true; }; const migrateBlockOptionsContentButtonsUrl = async ( @@ -75,9 +74,8 @@ const migrateBlockOptionsContentButtonsUrl = async ( } catch (error) { services.logger.error(`Failed to update button url : ${error.message}`); - return false; + throw error instanceof Error ? error : new Error(error); } - return true; }; const migrateBlockOptionsFallback = async (services: MigrationServices) => { @@ -98,7 +96,7 @@ const migrateBlockOptionsFallback = async (services: MigrationServices) => { ); } catch (error) { services.logger.error(`Failed to update max_attempts : ${error.message}`); - return false; + throw error instanceof Error ? error : new Error(error); } try { @@ -114,9 +112,8 @@ const migrateBlockOptionsFallback = async (services: MigrationServices) => { services.logger.error( `Failed to update max_attempts, active : ${error.message}`, ); - return false; + throw error instanceof Error ? error : new Error(error); } - return true; }; module.exports = { @@ -127,8 +124,9 @@ module.exports = { await migrateBlockOptionsFallback(services); return true; - } catch (err) { - return false; + } catch (error) { + services.logger.error(`Migration failed : ${error.message}`); + throw error instanceof Error ? error : new Error(error); } }, async down(_services: MigrationServices) {