blob: c4f8ac930f457056b7aa914f568062b42c8e6e9a [file] [log] [blame]
// Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.
export function assert(condition: boolean, message: string): void {
/* istanbul ignore if */
if (!condition) {
throw new Error('ASSERT: ' + message);
}
}