MCPcopy Create free account
hub / github.com/Snapchat/Valdi / assert

Method assert

valdi/vscode_debugger/src/common/logging/proxyLogger.ts:97–110  ·  view source on GitHub ↗

* Makes an assertion, *logging* if it failed.

(assertion: T | false | undefined | null, message: string)

Source from the content-addressed store, hash-verified

95 * Makes an assertion, *logging* if it failed.
96 */
97 public assert<T>(assertion: T | false | undefined | null, message: string): assertion is T {
98 if (assertion === false || assertion === undefined || assertion === null) {
99 this.error(LogTag.RuntimeAssertion, message, { error: new Error('Assertion failed') });
100
101 if (process.env.JS_DEBUG_THROW_ASSERTIONS) {
102 throw new Error(message);
103 }
104
105 debugger; // break when running in development
106 return false;
107 }
108
109 return true;
110 }
111
112 /**
113 * @inheritdoc

Callers

nothing calls this directly

Calls 1

errorMethod · 0.95

Tested by

no test coverage detected