As an open-source project, nlohmann/exception_reporter has picked up 27 stars on GitHub (Python). A tool to collect the exceptions that can reach a C++ function
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
This tool tries to answer this r/cpp question for a tool to find out, for a given function in my code base, which exceptions it may encounter. It is a simple Python script processing a callgraph generated by Clang. It is far from being ready or useful, but demonstrates that this approach could be feasible.
Please open an issue for ideas or bugs.
Example
Assume the following C++ program:
#include <map>
using int_map = std::map<int, int>;
int bar(int i, const int_map& m)
{
if (i == 100)
{
throw std::runtime_error("oops");
}
try
{
return m.at(i);
}
catch (std::out_of_range&)
{
return -1;
}
}
int main()
{
int_map m;
m[1] = 1;
if (bar(2, m) == -1)
{
return 1;
}
}
The goal is to find out which exceptions can be encountered in its functions; that is, which try/catch block needs to be written.
# step 1: create a callgraph with clang and demangle its C++ symbols
clang++ -S -emit-llvm examples/example.cpp -o - | opt -print-callgraph 2>&1 | sed "s/'/\"/g" | c++filt -n > callgraph.txt
# step 2: analyze the callgraph
./exeption_reporter.py callgraph.txt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
TopGit's last sync did not record any GitHub topics for nlohmann/exception_reporter. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on nlohmann/exception_reporter?
The most recent commit recorded on nlohmann/exception_reporter was 7.3 years ago, based on the GitHub push timestamp. The repository has 1 forks — one of the better signals of community interest.
How many stars does nlohmann/exception_reporter have?
nlohmann/exception_reporter has 27 GitHub stars — refresh the page for the live number, or check github.com/nlohmann/exception_reporter. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is nlohmann/exception_reporter open source?
Yes — nlohmann/exception_reporter ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/nlohmann/exception_reporter.
Where can I see nlohmann/exception_reporter in action?
The project maintains a homepage at https://www.reddit.com/r/cpp/comments/clss2i/how_to_find_all_exceptions_a_function_could_throw/. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about nlohmann/exception_reporter?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/nlohmann/exception_reporter is the definitive source.
Read full README in the tab above.
Want a second opinion on exception_reporter?
Ask an AI that can read this page — one click and you get its take on exception_reporter.