vishalxl / nostr_console

Nostr console is an open-source twitter-like social network, direct chat app and group chat all bundled into one program. Built on the decentralized Nostr protocol.
GNU Affero General Public License v3.0
441 stars 33 forks source link

Google translate is giving unhandled exception and crashing the application #12

Closed vishalxl closed 2 years ago

vishalxl commented 2 years ago
Unhandled exception:
Connection closed before full header was received
#0      IOClient.send (package:http/src/io_client.dart:90:7)
<asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:32)
<asynchronous suspension>
#2      _withClient (package:http/http.dart:164:12)
<asynchronous suspension>
#3      GoogleTranslator.translate (package:translator/src/google_translator.dart:51:18)
<asynchronous suspension>
vishalxl commented 2 years ago

Seeing this likely unrelated error. Its seen both on windows Terminal, and on Ubuntu elf file running in WSL.

Refreshing...
Unhandled exception:
Instance of 'LanguageNotSupportedException'
#0      LanguageList.[] (package:translator/src/langs/language.dart:128:5)
#1      GoogleTranslator.translate (package:translator/src/google_translator.dart:79:36)
<asynchronous suspension>

Some lanaguages like 'qu'/Quechua aren't mentioned in the Dart package, which means that if the Google Translate service returns such a language, this exception is thrown.

vishalxl commented 2 years ago

Fixed it by catching the exception.