MCPcopy
hub / github.com/microsoft/vscode / assert

Function assert

src/vs/base/common/assert.ts:44–56  ·  view source on GitHub ↗
(
	condition: boolean,
	messageOrError: string | Error = 'unexpected state',
)

Source from the content-addressed store, hash-verified

42 * @param messageOrError An error message or error object to throw if condition is `falsy`.
43 */
44export function assert(
45 condition: boolean,
46 messageOrError: string | Error = 'unexpected state',
47): asserts condition {
48 if (!condition) {
49 // if error instance is provided, use it, otherwise create a new one
50 const errorToThrow = typeof messageOrError === 'string'
51 ? new BugIndicatingError(`Assertion Failed: ${messageOrError}`)
52 : messageOrError;
53
54 throw errorToThrow;
55 }
56}
57
58/**
59 * Like assert, but doesn't throw.

Calls

no outgoing calls

Tested by 15

assertMapEqualsFunction · 0.40
getCompletionsFunction · 0.40
getCompletionsFunction · 0.40
runMethod · 0.40
getValueFunction · 0.40
createDocumentMethod · 0.40
assertInlineColorFunction · 0.40
assertElementIsLinkFunction · 0.40
openTunnelMethod · 0.40
validateMethod · 0.40
rejectsMethod · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…