Skip to content

Commit

Permalink
Merge main into sweep/update_the_docstrings_and_comments_in_sd_214b1
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Apr 18, 2024
2 parents 363d9f8 + 03302c9 commit fe38e55
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sdks/ts/src/utils/invariant.ts
Original file line number Diff line number Diff line change
@@ -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);
}
Expand Down

0 comments on commit fe38e55

Please # to comment.