mirror of
https://github.com/Syping/dtranslatebot.git
synced 2025-12-04 10:51:48 +01:00
improve logging and some refactor
This commit is contained in:
parent
86351b9537
commit
b09da9cfce
8 changed files with 112 additions and 82 deletions
|
|
@ -59,11 +59,8 @@ const std::vector<language> libretranslate::get_languages()
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (const dpp::json::exception &exception) {
|
||||
std::cerr << "Exception thrown while parsing supported languages JSON: " << exception.what() << std::endl;
|
||||
}
|
||||
catch (const std::exception &exception) {
|
||||
std::cerr << "Exception thrown while getting supported languages: " << exception.what() << std::endl;
|
||||
std::cerr << "[dtranslatebot] Exception: " << exception.what() << std::endl;
|
||||
}
|
||||
|
||||
return languages;
|
||||
|
|
@ -96,11 +93,8 @@ const std::string libretranslate::translate(const std::string &text, const std::
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (const dpp::json::exception &exception) {
|
||||
std::cerr << "Exception thrown while parsing translated JSON: " << exception.what() << std::endl;
|
||||
}
|
||||
catch (const std::exception &exception) {
|
||||
std::cerr << "Exception thrown while translating: " << exception.what() << std::endl;
|
||||
std::cerr << "[dtranslatebot] Exception: " << exception.what() << std::endl;
|
||||
}
|
||||
|
||||
return text;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue