try/except dynamic error handling