September 8, 2025
- It does not detect, it just kind of predicts if the program is going to throw an exception.
- It does not run the program or confirms that an exception will or won’t occur.
- It gives false positive and false negative such as it count comments and strings as the part of the source code
if "int(" in line or "float(" in line:
warnings.append(f"Possible ValueError in conversion at line {i}")
DetectThrowsException
program is a heuristic demonstration of a decision problem. It cannot prove whether an exception will occur, but it offers a first step by flagging suspicious patterns in source code.✅ Can Do | ❌ Cannot Do |
---|---|
Detect simple patterns with regex (e.g., /0 , int("abc") , raise ) |
Prove with certainty that exceptions will (or won’t) occur |
Flag likely sources of runtime errors early | Account for user input, runtime values, or complex program logic |
Provide a practical, lightweight heuristic | Solve the general problem (undecidable, like the halting problem) |
Key takeaway: A simple heuristic can still make a meaningful impact in software development, despite theoretical limits.
Proofgrammers