@xaendar/signals 0.4.11 → 0.5.2

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.
@@ -366,6 +366,7 @@ var Computed = class Computed {
366
366
  try {
367
367
  newValue = this.#callback.call(this);
368
368
  } catch (error) {
369
+ if (isDevMode()) console.error("Error thrown while computing a Computed signal:", error);
369
370
  newValue = {
370
371
  isError: true,
371
372
  value: error
@@ -603,6 +604,9 @@ var State = class {
603
604
  GLOBAL_STATE.frozen = true;
604
605
  try {
605
606
  this.#watched();
607
+ } catch (error) {
608
+ if (isDevMode()) console.error("Error thrown while running a State Signal watched callback:", error);
609
+ throw error;
606
610
  } finally {
607
611
  GLOBAL_STATE.frozen = false;
608
612
  }
@@ -627,6 +631,9 @@ var State = class {
627
631
  GLOBAL_STATE.frozen = true;
628
632
  try {
629
633
  this.#unwatched();
634
+ } catch (error) {
635
+ if (isDevMode()) console.error("Error thrown while running a State Signal unwatched callback:", error);
636
+ throw error;
630
637
  } finally {
631
638
  GLOBAL_STATE.frozen = false;
632
639
  }
@@ -814,6 +821,9 @@ var Watcher = class {
814
821
  try {
815
822
  this.setState("pending", PRIVATE);
816
823
  this.#notifyCallback.call(this);
824
+ } catch (error) {
825
+ if (isDevMode()) console.error("Error thrown while running a Watcher notify callback:", error);
826
+ throw error;
817
827
  } finally {
818
828
  this.setState("waiting", PRIVATE);
819
829
  GLOBAL_STATE.frozen = false;
@@ -839,6 +849,9 @@ function untrack(fn) {
839
849
  GLOBAL_STATE.computing = null;
840
850
  try {
841
851
  return fn();
852
+ } catch (error) {
853
+ if (isDevMode()) console.error("Error thrown while running an Untracked signal:", error);
854
+ throw error;
842
855
  } finally {
843
856
  GLOBAL_STATE.computing = prevComputing;
844
857
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaendar/signals",
3
- "version": "0.4.11",
3
+ "version": "0.5.2",
4
4
  "description": "A library implementing a reactive system for Xaendar framework. This signal implementation is based on the TC39 Stage1 proposal for reactive primitives.",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@xaendar/common": "0.4.11",
20
- "@xaendar/types": "0.4.11"
19
+ "@xaendar/common": "0.5.2",
20
+ "@xaendar/types": "0.5.2"
21
21
  }
22
22
  }