bergamot-translator
bergamot-translator copied to clipboard
Error handling and stream improvements for command-line apps
- Avoid copies through stringstream (of widespread use currently in BRT) to read into a string using buffered read.
- BRT command line does not do error handling - whether the file exists, are we running out of space on write that sort. Handle that as well.
- Past refactoring PRs have aggressively squeezed stream reads into a single place:
https://github.com/browsermt/bergamot-translator/blob/bcbbfe129525ed2be8dbf00d2da9d412667f1d8d/src/translator/utils.h#L7-L13
- Having turned off logging by default and seen experienced Marian users use:
// Set marian to throw exceptions instead of std::abort()
marian::setThrowExceptionOnAbort(true);
https://github.com/XapaJIaMnu/translateLocally/blob/6f40bceedb4909dfead81441cfb606582c43dcaf/src/main.cpp#L13
thinking the above would be nice to incorporate.