예제 #1
0
        internal static Exception CreateException(SttError err)
        {
            Tizen.Log.Error(LogTag, "Error " + err);
            Exception exp;

            switch (err)
            {
            case SttError.OutOfMemory:
            {
                exp = new OutOfMemoryException("Out Of Memory");
                break;
            }

            case SttError.IoError:
            {
                exp = new InvalidOperationException("I/O Error Occurred");
                break;
            }

            case SttError.InvalidParameter:
            {
                exp = new ArgumentException("Invalid Parameters Provided");
                break;
            }

            case SttError.TimedOut:
            {
                exp = new TimeoutException("No answer from the STT service");
                break;
            }

            case SttError.OutOfNetwork:
            {
                exp = new InvalidOperationException("Network is down");
                break;
            }

            case SttError.PermissionDenied:
            {
                exp = new UnauthorizedAccessException("Permission Denied");
                break;
            }

            case SttError.NotSupported:
            {
                exp = new NotSupportedException("STT NOT supported");
                break;
            }

            case SttError.InvalidState:
            {
                exp = new InvalidOperationException("Invalid state");
                break;
            }

            case SttError.InvalidLanguage:
            {
                exp = new InvalidOperationException("Invalid language");
                break;
            }

            case SttError.EngineNotFound:
            {
                exp = new InvalidOperationException("No available engine");
                break;
            }

            case SttError.OperationFailed:
            {
                exp = new InvalidOperationException("Operation Failed");
                break;
            }

            case SttError.NotSupportedFeature:
            {
                exp = new InvalidOperationException("Not supported feature of current engine");
                break;
            }

            case SttError.RecordingTimedOut:
            {
                exp = new InvalidOperationException("Recording timed out");
                break;
            }

            case SttError.NoSpeech:
            {
                exp = new InvalidOperationException("No speech while recording");
                break;
            }

            case SttError.InProgressToReady:
            {
                exp = new InvalidOperationException("Progress to ready is not finished");
                break;
            }

            case SttError.InProgressToRecording:
            {
                exp = new InvalidOperationException("Progress to recording is not finished");
                break;
            }

            case SttError.InProgressToProcessing:
            {
                exp = new InvalidOperationException("Progress to processing is not finished");
                break;
            }

            case SttError.ServiceReset:
            {
                exp = new InvalidOperationException("Service reset");
                break;
            }

            default:
            {
                exp = new Exception("");
                break;
            }
            }

            return(exp);
        }
 /// <summary>
 /// The class constructor.
 /// </summary>
 /// <param name="error">Error value.</param>
 public ServiceErrorEventArgs(SttError error)
 {
     Error = error;
 }