locked
Error Handling RRS feed

  • Question

  • How can I properly know which errors are returned? This so I can show the users a proper error.

    Currently I'm trying to parse the message (SOAP api):

                try
                {
                    translatedText = _languageServiceClient.Translate(GetAppIdToken(), textToTranslate, languageFrom, languageTo, "text/plain""general");
                }
                catch (FaultException faultException)
                {
                    //http://social.msdn.microsoft.com/Forums/en-US/microsofttranslator/thread/5c76aac1-6d28-49ac-8f96-5f66c47b35bc/ - From language cannot be detected
                    if (faultException.Message.Contains("'from' must be a valid language"))
                    {
                        return ErrorCode.TRANSLATIONS_FROMLANGUAGENOTDETECTED;
                    }
                    //http://social.msdn.microsoft.com/Forums/en/microsofttranslator/thread/76f6bb3e-e34c-4056-9e64-4c8b26e618fe/ - Too much traffic
                    else if (faultException.Message.Contains("too busy"))
                    {
                        return ErrorCode.TRANSLATIONS_TOOBUSY;
                    }
                    return ErrorCode.TRANSLATIONS_TRANSLATIONSWEBSERVICESERROR;
                }
    The "from language is not detected" part works. The overloads never returns the "too busy" error message.
    Tuesday, September 20, 2011 8:38 AM

Answers

  • "too busy" is very rarely returned. Most of the time the service is able to return a translation on time. Let me know if you have any other question.
    Wednesday, September 21, 2011 6:28 PM

All replies

  • Carra - I passed this on to our technical team who will respond shortly.
    Vikram Dendi, Director of Product Management
    Microsoft Translator
    Wednesday, September 21, 2011 7:39 AM
  • "too busy" is very rarely returned. Most of the time the service is able to return a translation on time. Let me know if you have any other question.
    Wednesday, September 21, 2011 6:28 PM