mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-06-06 04:59:45 +02:00
caught translate exception
fixes the translate crash
This commit is contained in:
parent
8ae05a6dd3
commit
97d2a18aad
@ -208,7 +208,11 @@ class EventData {
|
|||||||
if( translator != null) {
|
if( translator != null) {
|
||||||
try {
|
try {
|
||||||
translator?.translate(content, to: 'en')
|
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) {
|
} on Exception catch(err) {
|
||||||
if( gDebug >= 0) print("Info: Error in trying to use google translate: $err");
|
if( gDebug >= 0) print("Info: Error in trying to use google translate: $err");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user