From 07be9c651ff2cd7c94c21fb12c4d7ff8a456cd49 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 18 Apr 2024 02:45:12 +0000 Subject: [PATCH] feat: Updated sdks/ts/src/utils/invariant.ts --- sdks/ts/src/utils/invariant.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdks/ts/src/utils/invariant.ts b/sdks/ts/src/utils/invariant.ts index a884df72f..eeeea7d9d 100644 --- a/sdks/ts/src/utils/invariant.ts +++ b/sdks/ts/src/utils/invariant.ts @@ -1,7 +1,13 @@ +/** + * Ensures that a condition is met, throwing a custom error message if not. + * @param condition The condition to test. If falsy, an error is thrown. + * @param message Optional. The error message to throw if the condition is not met. Defaults to "Invariant Violation". + */ export function invariant( condition: any, message: string = "Invariant Violation", ): void { + // Throw an error with the provided message if the condition is falsy if (!condition) { throw new Error(message); }