Add error handling

adds error handling by raising an exception if the request error'd out.