Skip to content

Commit

Permalink
error suppression examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarParra committed Dec 5, 2024
1 parent b37ebab commit acb75f0
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions examples/demo-signals/lwc/demoSignals/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ $computed(
throw new Error("An error occurred during a computation");
},
{
identifier: "computed-with-error"
errorHandler: (error) => {
console.error("error thrown from computed", error);
// Allows for a fallback value to be returned when an error occurs.
return 0;
}
}
);

$effect(() => {
throw new Error("An error occurred during an effect");
});
$effect(
() => {
throw new Error("An error occurred during an effect");
},
{
errorHandler: (error) => {
console.error("error thrown from effect", error);
}
}
);

0 comments on commit acb75f0

Please sign in to comment.