Catch exceptions from the database library