fix: add throw propagation

This commit is contained in:
yassinedorbozgithub 2025-05-29 17:37:34 +01:00
parent 8c9c5141ab
commit 8370ca692c

View File

@ -53,9 +53,8 @@ const migrateBlockOptionsContentLimit = async (services: MigrationServices) => {
} catch (error) { } catch (error) {
services.logger.error(`Failed to update limit : ${error.message}`); services.logger.error(`Failed to update limit : ${error.message}`);
return false; throw error instanceof Error ? error : new Error(error);
} }
return true;
}; };
const migrateBlockOptionsContentButtonsUrl = async ( const migrateBlockOptionsContentButtonsUrl = async (
@ -75,9 +74,8 @@ const migrateBlockOptionsContentButtonsUrl = async (
} catch (error) { } catch (error) {
services.logger.error(`Failed to update button url : ${error.message}`); 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) => { const migrateBlockOptionsFallback = async (services: MigrationServices) => {
@ -98,7 +96,7 @@ const migrateBlockOptionsFallback = async (services: MigrationServices) => {
); );
} catch (error) { } catch (error) {
services.logger.error(`Failed to update max_attempts : ${error.message}`); services.logger.error(`Failed to update max_attempts : ${error.message}`);
return false; throw error instanceof Error ? error : new Error(error);
} }
try { try {
@ -114,9 +112,8 @@ const migrateBlockOptionsFallback = async (services: MigrationServices) => {
services.logger.error( services.logger.error(
`Failed to update max_attempts, active : ${error.message}`, `Failed to update max_attempts, active : ${error.message}`,
); );
return false; throw error instanceof Error ? error : new Error(error);
} }
return true;
}; };
module.exports = { module.exports = {
@ -127,8 +124,9 @@ module.exports = {
await migrateBlockOptionsFallback(services); await migrateBlockOptionsFallback(services);
return true; return true;
} catch (err) { } catch (error) {
return false; services.logger.error(`Migration failed : ${error.message}`);
throw error instanceof Error ? error : new Error(error);
} }
}, },
async down(_services: MigrationServices) { async down(_services: MigrationServices) {