Type-safe and user-friendly error handling in Swift 6