caught translate exception

fixes the translate crash
This commit is contained in:
Vishal 2022-10-07 03:16:58 +05:30
parent 8ae05a6dd3
commit 97d2a18aad

View File

@ -208,7 +208,11 @@ class EventData {
if( translator != null) {
try {
translator?.translate(content, to: 'en')
.then( (result) => { evaluatedContent = "$evaluatedContent\n\nTranslation: ${result.toString()}" , if( gDebug > 0) print("Google translate returned successfully for one call.")}
.then( (result) => { evaluatedContent = "$evaluatedContent\n\nTranslation: ${result.toString()}" , if( gDebug > 0) print("Google translate returned successfully for one call.")} )
.onError((error, stackTrace) {
if( gDebug > 0) print("Translate error = $error\n for content = $content\n");
return {} ;
}
);
} on Exception catch(err) {
if( gDebug >= 0) print("Info: Error in trying to use google translate: $err");