mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: add throw propagation
This commit is contained in:
parent
8c9c5141ab
commit
8370ca692c
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user