@ibgib/core-gib 0.0.77 → 0.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -380,6 +380,7 @@ export async function getSpecialIbGib({
380
380
  fnBroadcast,
381
381
  fnGetInitializing,
382
382
  fnSetInitializing,
383
+ dontWarnIfNotExist,
383
384
  }: {
384
385
  type: SpecialIbGibType,
385
386
  initialize?: boolean,
@@ -406,6 +407,11 @@ export async function getSpecialIbGib({
406
407
  * Because we don't want to initialize while we're initializing.
407
408
  */
408
409
  fnSetInitializing?: (x: boolean) => void,
410
+ /**
411
+ * if true, won't warn about non-existent/non-initialized things.
412
+ * useful if you are just checking to see if a special ibgib exists.
413
+ */
414
+ dontWarnIfNotExist?: boolean,
409
415
  }): Promise<IbGib_V1 | null> {
410
416
  const lc = `[${getSpecialIbGib.name}]`;
411
417
  try {
@@ -414,7 +420,7 @@ export async function getSpecialIbGib({
414
420
  let key = getSpecialConfigKey({ type });
415
421
  let addr = await getConfigAddr({
416
422
  key, space,
417
- dontWarn: !!initialize // dont warn if we're initializing
423
+ dontWarn: dontWarnIfNotExist || !!initialize // dont warn if we're initializing
418
424
  });
419
425
 
420
426
  if (!addr) {
@@ -435,7 +441,7 @@ export async function getSpecialIbGib({
435
441
  console.warn(`${lc} couldn't get addr, but we're still initializing...`);
436
442
  return null;
437
443
  } else {
438
- throw new Error(`Special address not in config and couldn't initialize it either.`);
444
+ throw new Error(`Special address not in config and couldn't initialize it either. (E: d8ebdc9eaaa640b99cd206f132962c93)`);
439
445
  }
440
446
  }
441
447
  }
@@ -474,7 +480,16 @@ export async function getSpecialIbGib({
474
480
 
475
481
  return specialIbGib;
476
482
  } catch (error) {
477
- console.error(`${lc} ${error.message}`);
483
+ const emsg = `${lc} ${error.message}`;
484
+ /**
485
+ * error code found in preceding try block (just do a find on it).
486
+ */
487
+ const notFoundErrorCode = 'd8ebdc9eaaa640b99cd206f132962c93';
488
+ if (emsg.includes(notFoundErrorCode) && dontWarnIfNotExist) {
489
+ // don't log error, it's expected
490
+ } else {
491
+ console.error(emsg);
492
+ }
478
493
  return null;
479
494
  }
480
495
  }
@@ -652,6 +667,10 @@ export async function getConfigAddr({
652
667
  }: {
653
668
  key: string,
654
669
  space: IbGibSpaceAny,
670
+ /**
671
+ * if true, won't warn about non-existent/non-initialized things.
672
+ * useful if you are just checking to see if a special ibgib exists.
673
+ */
655
674
  dontWarn?: boolean,
656
675
  }): Promise<string | undefined> {
657
676
  const lc = `[${getConfigAddr.name}](${key})`;