MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / createErrorProxy

Function createErrorProxy

src/shared/Util.ts:345–356  ·  view source on GitHub ↗
(title: string)

Source from the content-addressed store, hash-verified

343 * @param title Title to use in the error, usually the name of the variable the error proxy will be set for
344 */
345export function createErrorProxy(title: string): any {
346 return new Proxy({}, {
347 // @TODO Make it throw errors for all(?) cases (delete, construct etc.)
348 get: (target, p) => {
349 if (p === errorProxySymbol) { return errorProxyValue; }
350 throw new Error(`You must not get a value from ${title} before it is initialized (property: "${p.toString()}").`);
351 },
352 set: (target, p) => {
353 throw new Error(`You must not set a value from ${title} before it is initialized (property: "${p.toString()}").`);
354 },
355 });
356}
357
358/**
359 * Convert a size (in bytes) to a more human readable format.

Callers 5

startBrowserModeFunction · 0.90
mainFunction · 0.90
startLoggerFunction · 0.90
index.tsFile · 0.90

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected