From b9d7da0413403805f035479a0a426c27102032f6 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Fri, 3 Jun 2011 20:49:52 -0400 Subject: Add exception catcher around constructor --- decoder/ff_klm.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/decoder/ff_klm.cc b/decoder/ff_klm.cc index 35b35d36..71ba9f30 100644 --- a/decoder/ff_klm.cc +++ b/decoder/ff_klm.cc @@ -385,7 +385,12 @@ KLanguageModel::KLanguageModel(const string& param) { if (!ParseLMArgs(param, &filename, &mapfile, &explicit_markers, &featname)) { abort(); } - pimpl_ = new KLanguageModelImpl(filename, mapfile, explicit_markers); + try { + pimpl_ = new KLanguageModelImpl(filename, mapfile, explicit_markers); + } catch (std::exception &e) { + std::cerr << e.what() << std::endl; + abort(); + } fid_ = FD::Convert(featname); oov_fid_ = FD::Convert(featname+"_OOV"); cerr << "FID: " << oov_fid_ << endl; -- cgit v1.2.3