Updated EndpointGateway to throw exceptions on errors