3 ms·
This is especially evident in e.g. third-party Python libraries. For example, say you have a pandas dataframe with a column "foo" and you accidentally try to r
by xamuel 7y ago
This is especially evident in e.g. third-party Python libraries.
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.
- fjp 7y agoThis is how it should be done, I'm such a fan of this page: https://www.psycopg.org/docs/errors.html 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.