Added support for handling ConnectionError

Added exception handling in this library for a personal project. Wanted to share the modifications.