Hi,
Getting the error code from an error protocol would seem to be an important capability, but as a swift newbie I can't figure it out. I'd appreciate some wisdom on how this works.
The specific situation is this:
When using the ios Speech library SFSpeechRecognizer framework I want to specially handle some errors from the 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 on inspection 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. Can anyone please explain how to get to the error parameters?
Or if that's not how errors should be handled, to better handle errors.
thanks