diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-11-29 07:39:08 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-02 09:37:25 +0200 |
commit | 04fb982b5e78949ed7bb65ca36a89decf9ee284e (patch) | |
tree | 52b0e4c178b1f40f9b5b4479499f59fec721572c /mod/mod-ci-github.cxx | |
parent | f29b6a2b789b6bcd40aeb4f50f0a20fa856fb752 (diff) |
build_built(): handle all exceptions
Diffstat (limited to 'mod/mod-ci-github.cxx')
-rw-r--r-- | mod/mod-ci-github.cxx | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index bfc6ebe..efe61e3 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -2263,6 +2263,7 @@ namespace brep build_built (const tenant_service& ts, const build& b, const diag_epilogue& log_writer) const noexcept + try { // NOTE: this function is noexcept and should not throw. @@ -2390,6 +2391,11 @@ namespace brep { using namespace web::xhtml; + // Note: let all serialization exceptions propagate. The XML + // serialization code can throw bad_alloc or xml::serialization in + // case of I/O failures, but we're serializing to a string stream so + // both exceptions are highly unlikely. + // ostringstream os; xml::serializer s (os, "check_run_summary"); @@ -2485,7 +2491,8 @@ namespace brep if (cr.node_id) { - // Update existing check run to built. + // Update existing check run to built. Let unlikely invalid_argument + // propagate. // if (gq_update_check_run (error, cr, @@ -2502,7 +2509,7 @@ namespace brep } else { - // Create new check run. + // Create new check run. Let unlikely invalid_argument propagate. // // Note that we don't have build hints so will be creating this check // run with the full build id as name. In the unlikely event that an @@ -2550,6 +2557,8 @@ namespace brep cr.node_id = *sd.conclusion_node_id; cr.name = conclusion_check_run_name; + // Let unlikely invalid_argument propagate. + // if (gq_update_check_run (error, cr, iat->token, @@ -2654,6 +2663,16 @@ namespace brep return sd.json (); }; } + catch (const std::exception& e) + { + NOTIFICATION_DIAG (log_writer); + + string bid (gh_check_run_name (b)); // Full build id. + + error << "check run " << bid << ": unhandled exception: " << e.what(); + + return nullptr; + } string ci_github:: details_url (const build& b) const |