Re:The general value of typed functional programming lies in...
by fjp on Monday February 24, 2020 @01:29PM
(#22406818)
This is how it should be done, I'm such a fan of this page: https://www.psycopg.org/docs/errors.html
Edit: by "this" I meant to agree with parent: Getting a useful, well defined exception is how it should be done. Psycopg2 does this very well.
For example, say you have a pandas dataframe with a column "foo" and you accidentally try to read column "fooo". Instead of getting a useful exception like "PandasException: Attempted to read nonexistent column 'fooo'", you get a traceback 10 layers deep, terminating in something like "pandas.hashtable.PyObjectHashTable.get_item" which ought to be totally invisible to you, the library user.