Jump to another example:
Basics
Store
Composables
Events
Forms
Features
Feature Showcase: Error Boundary
Capture action failures with #[ErrorBoundary] and recover in UI.
How it works
The component is annotated with #[ErrorBoundary].
When an action throws, LiVue exposes the failure in
livue.errorState, and the UI can recover without a full reload.
Successful actions
0
Last safe action
Never
#[ErrorBoundary] keeps the component interactive even when a method throws.
app/LiVue/ErrorBoundaryDemo.php
#[ErrorBoundary(message: 'Demo error captured...', recover: true)]
class ErrorBoundaryDemo extends Component
{
public function throwDemoError(): void
{
throw new RuntimeException('Simulated failure...');
}
}
resources/views/livue/error-boundary-demo.blade.php
<div v-if="livue.errorState.hasError">
<p v-text="livue.errorState.errorMessage"></p>
<button @click="livue.clearError()">Dismiss</button>
</div>