Skip to content

Commit 93945c0

Browse files
committed
minor logging for bug fixes
1 parent fdc24ac commit 93945c0

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

otc/ws/tolws.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,12 @@ inline void add_source_id_map(json & j,
382382
if (srcTag == string("ott")+taxonomy.get_version()) {
383383
jt["taxonomy"] = string("ott")+taxonomy.get_version();
384384
} else {
385-
const auto & simentry = sta->source_id_map.at(srcTag);
386-
jt = simentry;
385+
try {
386+
const auto & simentry = sta->source_id_map.at(srcTag);
387+
jt = simentry;
388+
} catch (...) {
389+
throw OTCWebError() << "sta->source_id_map.at(" << srcTag << ") exception.";
390+
}
387391
}
388392
sim[srcTag] = jt;
389393
}
@@ -777,7 +781,12 @@ string arguson_subtree_ws_method(const TreesToServe & tts,
777781
{
778782
auto locked_taxonomy = tts.get_readable_taxonomy();
779783
const auto & taxonomy = locked_taxonomy.first;
780-
write_arguson(a, tts, sta, taxonomy, focal, height_limit, usedSrcIds);
784+
try {
785+
write_arguson(a, tts, sta, taxonomy, focal, height_limit, usedSrcIds);
786+
} catch (...) {
787+
LOG(DEBUG) << "Exception in arguson_subtree_ws_method";
788+
throw;
789+
}
781790
add_lineage(tts, a, focal, taxonomy, usedSrcIds, true);
782791
add_source_id_map(a, usedSrcIds, taxonomy, sta);
783792
}

otc/ws/trees_to_serve.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,12 @@ set<string> TreesToServe::get_available_trees() const
172172

173173
const SummaryTreeAnnotation * TreesToServe::get_annotations(string synth_id) const {
174174
const auto & key = synth_id.empty() ? default_synth_id : synth_id;
175+
LOG(DEBUG) << " key = \"" << key << "\" synth_id = \"" << synth_id << "\"";
175176
auto mit = id_to_annotations.find(key);
176-
return mit == id_to_annotations.end() ? nullptr : mit->second;
177+
if (mit == id_to_annotations.end()) {
178+
return nullptr;
179+
}
180+
return mit->second;
177181
}
178182

179183
const SummaryTree_t * TreesToServe::get_summary_tree(string synth_id) const {

ws/tolwsbooting.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,11 +702,16 @@ create_method_handler(const string& path, const std::function<std::string(const
702702
LOG(DEBUG)<<"request: DONE";
703703
session->close( OK, rbody, request_headers(rbody) );
704704
} catch (OTCWebError& e) {
705+
LOG(DEBUG) << "OTCWebError: " << e.what();
705706
string rbody = error_response(path,e);
706707
session->close( e.status_code(), rbody, request_headers(rbody) );
707708
} catch (OTCError& e) {
709+
LOG(DEBUG) << "OTCError: " << e.what();
708710
string rbody = error_response(path,e);
709711
session->close( 500, rbody, request_headers(rbody) );
712+
} catch (std::exception& e) {
713+
LOG(DEBUG) << "std::exception: " << e.what();
714+
throw;
710715
}
711716
});
712717
};

0 commit comments

Comments
 (0)