Skip to content

Commit

Permalink
refactor: let it throw
Browse files Browse the repository at this point in the history
  • Loading branch information
vitoUwu committed Dec 12, 2024
1 parent 9059b24 commit 7890b78
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions blocks/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@ const flagBlock: Block<BlockModule<FlagFunc>> = {
let ruleResult = variant?.rule(ctx);
// the rule can sometimes be a promise and we need to await it to check if it's truthy or not
if (isAwaitable(ruleResult)) {
try {
ruleResult = await ruleResult;
} catch (_) {
// if the rule throws an error, we don't match this variant
ruleResult = false;
}
ruleResult = await ruleResult;
}
if (ruleResult) {
match = variant;
Expand Down

0 comments on commit 7890b78

Please sign in to comment.