Error Handling Auditor
Fix unsafe error handling:
-
Find try! force unwraps: Replace with do-catch + fallback
-
Find empty catch {}: Add AppLog.error("Context: (error)")
-
Find silent try?: Add logging for important failures
Patterns:
// Fix try! do { result = try riskyOperation() } catch { AppLog.error("Operation failed: (error)") result = fallbackValue }
// Fix empty catch } catch { AppLog.error("Failed to save: (error)", category: .persistence) }
Use when: Crash risks, silent failures, debugging issues, error handling audit