wails/v2/pkg
Lea Anthony ca206452cd The panic handling has been ported to v2. Here's a summary of the changes:
## Summary of Changes

**1. Created `v2/internal/frontend/desktop/linux/panic_handler.go`**
- Ported the panic recovery logic from v3
- Includes `getStackTrace()` function for generating readable stack traces
- `handlePanic()` function that recovers from panics and either calls the custom handler or logs the error

**2. Added to `v2/pkg/options/options.go`**
- Added `PanicDetails` struct with `StackTrace`, `Error`, `Time`, and `FullStackTrace` fields
- Added `PanicHandler` type: `func(*PanicDetails)`
- Added `PanicHandler` field to the `App` struct with documentation

**3. Modified `v2/internal/frontend/desktop/linux/frontend.go`**
- Added `defer handlePanic(f.frontendOptions.PanicHandler, f.logger)` to the goroutine in `processMessage()` (line 468)

## Usage Example

Users can now configure a custom panic handler in their v2 Wails application:

```go
app := wails.Run(&options.App{
    Title: "My App",
    // ... other options
    PanicHandler: func(details *options.PanicDetails) {
        // Custom panic handling logic
        log.Printf("Panic occurred at %v: %v\n%s",
            details.Time,
            details.Error,
            details.StackTrace)
        // Could show error dialog, send to error tracking service, etc.
    },
})
```

If no `PanicHandler` is set, panics will be logged via the application logger and the application will continue running instead of crashing with a signal handler error.
2026-01-28 08:09:24 +11:00
..
application [chore] lint fixes 2023-11-12 12:30:49 +11:00
assetserver FIX: Address Mac CGO Crash (#3590) 2024-08-20 18:12:56 +10:00
buildassets Fix for webview2 detection 2025-04-12 13:21:37 +10:00
clilogger Releasetest/release workflow (#1869) 2022-09-18 08:55:21 +10:00
commands fix: cross compiling on linux for windows (#4263) 2025-05-19 21:16:10 +10:00
git Fixed an error that occurred when an author name contains a string that is not suitable for JSON (#3638) 2024-07-29 21:34:19 +10:00
logger fix dev mode logging bug (#3972) 2025-01-23 11:12:18 +00:00
mac chore: fix function names in comment (#3383) 2024-04-09 17:19:06 -05:00
menu chore: fix some comments (#3932) 2024-12-06 14:35:46 +11:00
options The panic handling has been ported to v2. Here's a summary of the changes: 2026-01-28 08:09:24 +11:00
runtime Fix Drag & Drop JS runtime (#3516) 2024-06-10 15:15:28 +10:00
templates fix: add missing EventsOffAll export to runtime templates (#4883) 2026-01-25 13:10:24 +11:00