When using the ios Speech library SFSpeechRecognizer framework I want to specially handle some errors from recognitionTask. The problem is I can't figure out how to extract the error code. I've looked all around and I couldn't find an example or explanation in the doc on how to get at it.
The signature:
func recognitionTask(with request: SFSpeechRecognitionRequest, resultHandler: @escaping (SFSpeechRecognitionResult?, Error?) -> Void) -> SFSpeechRecognitionTask
Drilling down on Error says it's "protocol Error" which doesn't help very much.
When there is an error the local description show's there's a code:
2018-10-20 12:33:49.037515-0700 readsay[55123:12025377] error: Optional(Error Domain=kAFAssistantErrorDomain Code=209 "(null)")
The problem is the error doesn't seem to contain anything recognizable as an error code. There are option for flatMap, map, localDescription, debugDescription, mirror, unsafelyWrapped.
My Swift is not very swift. I assume the data is in the maps but there's no typing information I can find so that I can't extract them.
Can anyone please explain how to get to the error parameters?
Can anyone please explain how to get an error code out of the error?