summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/util/invariants.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/util/invariants.ts')
-rw-r--r--packages/taler-wallet-core/src/util/invariants.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/util/invariants.ts b/packages/taler-wallet-core/src/util/invariants.ts
index fa381d333..b788d044e 100644
--- a/packages/taler-wallet-core/src/util/invariants.ts
+++ b/packages/taler-wallet-core/src/util/invariants.ts
@@ -27,3 +27,13 @@ export function checkDbInvariant(b: boolean, m?: string): asserts b {
}
}
}
+
+export function checkLogicInvariant(b: boolean, m?: string): asserts b {
+ if (!b) {
+ if (m) {
+ throw Error(`BUG: logic invariant failed (${m})`);
+ } else {
+ throw Error("BUG: logic invariant failed");
+ }
+ }
+}