mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
13 lines
427 B
TypeScript
13 lines
427 B
TypeScript
/**
|
|
* Asserts that an assumption is true. This is used to detect programmer errors
|
|
* and should never actually throw in a correctly written program.
|
|
* @param condition A condition that is assumed to be true
|
|
* @param message Informational message for debugging
|
|
*/
|
|
export function assert(condition: boolean, message: string): void {
|
|
/* istanbul ignore next */
|
|
if (!condition) {
|
|
throw Error(message);
|
|
}
|
|
}
|