An exception handling revelation
I’ve been working with exceptions offered by languages, such as Java and Python, for more than 20 years, invariably as their consumer: catching them when raised by an API and then doing my thing. For the systems I worked on, exception handling mostly involved either quitting the program with an error or re-prompting the user to fix some input. Consequently, my view of them was as a fancy error handling mechanism: syntactic sugar and static enforcement for checking a function’s successful completion. Recently, I refactored the error handling in Alexandria3k, a library and a command-line tool providing efficient relational query access to diverse publication open data sets. Through this the full power of exceptions clicked for me. I suspect that others may share my previously limited appreciation of exception handling, so here is a brief description of the refactoring.
Continue reading "An exception handling revelation"