From 76dc78645e250113d686f8c1c65e14c899b80e6d Mon Sep 17 00:00:00 2001 From: Beingpax Date: Fri, 25 Jul 2025 17:59:09 +0545 Subject: [PATCH] refactor: Clean up Ollama error handling logic --- VoiceInk/Services/AIEnhancementService.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/VoiceInk/Services/AIEnhancementService.swift b/VoiceInk/Services/AIEnhancementService.swift index 25f1853..8fcdfb7 100644 --- a/VoiceInk/Services/AIEnhancementService.swift +++ b/VoiceInk/Services/AIEnhancementService.swift @@ -183,7 +183,11 @@ class AIEnhancementService: ObservableObject { let filteredResult = AIEnhancementOutputFilter.filter(result) return filteredResult } catch { - throw EnhancementError.customError(error.localizedDescription) + if let localError = error as? LocalAIError { + throw EnhancementError.customError(localError.errorDescription ?? "An unknown Ollama error occurred.") + } else { + throw EnhancementError.customError(error.localizedDescription) + } } }