added exception support to the API client