added better exception handling to hn_api.py