Files
Desktop/ts/windows/callingtools/assert.js
adel-signal 8a9ab8c13f Add calling tools to visualize ringrtc stats
Co-authored-by: ayumi-signal <ayumi@signal.org>
2024-05-22 17:28:01 -07:00

19 lines
584 B
JavaScript

// Derived from Chromium WebRTC Internals Dashboard - see Acknowledgements for full license details
export function assert(value, message) {
if (value) {
return;
}
throw new Error("Assertion failed" + (message ? `: ${message}` : ""));
}
export function assertInstanceof(value, type, message) {
if (value instanceof type) {
return;
}
throw new Error(
message || `Value ${value} is not of type ${type.name || typeof type}`,
);
}
export function assertNotReached(message = "Unreachable code hit") {
assert(false, message);
}