mapToPicovoiceException function
Implementation
mapToPicovoiceException(Exception ex, String? message) {
switch (ex.runtimeType) {
case PorcupineException:
case RhinoException:
return PicovoiceException(message);
case PorcupineMemoryException:
case RhinoMemoryException:
return PicovoiceMemoryException(message);
case PorcupineIOException:
case RhinoIOException:
return PicovoiceIOException(message);
case PorcupineInvalidArgumentException:
case RhinoInvalidArgumentException:
return PicovoiceInvalidArgumentException(message);
case PorcupineStopIterationException:
case RhinoStopIterationException:
return PicovoiceStopIterationException(message);
case PorcupineKeyException:
case RhinoKeyException:
return PicovoiceKeyException(message);
case PorcupineInvalidStateException:
case RhinoInvalidStateException:
return PicovoiceInvalidStateException(message);
case PorcupineRuntimeException:
case RhinoRuntimeException:
return PicovoiceRuntimeException(message);
case PorcupineActivationException:
case RhinoActivationException:
return PicovoiceActivationException(message);
case PorcupineActivationLimitException:
case RhinoActivationLimitException:
return PicovoiceActivationLimitException(message);
case PorcupineActivationThrottledException:
case RhinoActivationThrottledException:
return PicovoiceActivationThrottledException(message);
case PorcupineActivationRefusedException:
case RhinoActivationRefusedException:
return PicovoiceActivationRefusedException(message);
default:
return PicovoiceException(
"unexpected exception: ${ex.runtimeType}, message: $message");
}
}