test: add boost cleanup service tests and expand booster role test coverage

This commit is contained in:
MythEclipse
2026-06-06 03:11:59 +07:00
parent a796034241
commit 0f6d9110a3
3 changed files with 234 additions and 2 deletions
+5
View File
@@ -141,11 +141,13 @@ export async function handleInteraction(
}
function toUserErrorMessage(error: unknown): string {
// Custom domain errors are safe to show directly
if (error instanceof ValidationError || error instanceof NotFoundError || error instanceof PermissionError) {
return error.message;
}
if (error instanceof Error) {
// Hide infrastructure/internal details
if (error.message.includes("Missing Permissions")) {
return "Bot is missing permissions or role position to manage this role.";
}
@@ -153,6 +155,9 @@ function toUserErrorMessage(error: unknown): string {
if (error.message.includes("Failed query") || error.message.includes("insert")) {
return "Failed to save booster role. Any created role was cleaned up. Try again.";
}
// Generic domain errors and validations are safe to show
return error.message;
}
return "Command failed";