Skip to content

Commit

Permalink
Add additional error descriptions in iOS (#484)
Browse files Browse the repository at this point in the history
* add additional error descriptions

* remove log on soundLevelChange
  • Loading branch information
fpinzn committed Feb 16, 2024
1 parent 9c82908 commit 24b193e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion speech_to_text/ios/Classes/SwiftSpeechToTextPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ public class SwiftSpeechToTextPlugin: NSObject, FlutterPlugin {
}

private func invokeFlutter( _ method: SwiftSpeechToTextCallbackMethods, arguments: Any? ) {
os_log("invokeFlutter %{PUBLIC}@", log: pluginLog, type: .debug, method.rawValue )
if(method != SwiftSpeechToTextCallbackMethods.soundLevelChange){
os_log("invokeFlutter %{PUBLIC}@", log: pluginLog, type: .debug, method.rawValue )
}
DispatchQueue.main.async {
self.channel.invokeMethod( method.rawValue, arguments: arguments )
}
Expand Down Expand Up @@ -596,12 +598,24 @@ extension SwiftSpeechToTextPlugin : SFSpeechRecognitionTaskDelegate {
if let err = task.error as NSError? {
var errorMsg: String
switch err.code {
case 102:
errorMsg = "error_assets_not_installed"
case 201:
errorMsg = "error_speech_recognizer_disabled"
case 203:
errorMsg = "error_retry"
case 301:
errorMsg = "error_request_cancelled"
case 1100:
errorMsg = "error_speech_recognizer_already_active"
case 1101:
errorMsg = "error_speech_recognizer_connection_invalidated"
case 1107:
errorMsg = "error_speech_recognizer_connection_interrupted"
case 1110:
errorMsg = "error_no_match"
case 1700:
errorMsg = "error_speech_recognizer_request_not_authorized"
default:
errorMsg = "error_unknown (\(err.code))"
}
Expand Down

0 comments on commit 24b193e

Please sign in to comment.