improve logging and some refactor

This commit is contained in:
Syping 2024-02-04 09:24:32 +01:00
parent 86351b9537
commit b09da9cfce
8 changed files with 112 additions and 82 deletions

View file

@ -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;