No exception thrown upon zero balance

36 views
Skip to first unread message

Devin Tuffy

unread,
Nov 21, 2013, 12:54:11 PM11/21/13
to microsoft-tran...@googlegroups.com

Hello all,

I've been using this library in an application with everything going smoothly, until yesterday when I ran out of balance on the Azure Marketplace. I'd assumed when this happened, I'd get an exception I could handle, something like this:

String translated = null;

try {

    translated = Translate.execute(sourceText, sourceLanguage, targetLanguage);

 } catch (Exception e) {

    // send an email notifying us something happened and return a fallback string

    return StringUtils.reverse(sourceText);

}        

return translated; 

Except when we ran out of credits, no exception was thrown -- instead Translate.execute just quietly returned "TranslateApiException: The Azure Market Place Translator Subscription associated with the request credentials has zero balance. : ID=3925.V2_Json.Translate.#######"

Is this a bug? Or is there something else I can check to see if the translation call failed? I'd rather not parse the returned string for error messages. :P

thanks,

devin

Reply all
Reply to author
Forward
0 new messages