From 53c1d6b0de851e87923e473f5296a353da73b8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Dug=C3=A9=20de=20Bernonville?= Date: Mon, 25 Nov 2024 12:52:07 +0100 Subject: [PATCH] Quota error handling on bdp request --- ChangeLog | 4 ++++ src/bdp.cpp | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 509cda8..70d53d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2024-11-25 Rodolphe Duge + + * src/bdp.c: Quota error handling on bdp request + 2024-09-18 Dirk Eddelbuettel * DESCRIPTION (Version, Date): New release 0.3.15 diff --git a/src/bdp.cpp b/src/bdp.cpp index 33d49fc..a5d5c16 100644 --- a/src/bdp.cpp +++ b/src/bdp.cpp @@ -55,6 +55,19 @@ void getBDPResult(Event& event, Rcpp::List& res, const std::vector& if (std::strcmp(response.name().string(),"ReferenceDataResponse")) { throw std::logic_error("Not a valid ReferenceDataResponse."); } + + const Name responseError("responseError"); + if (response.hasElement(responseError)) { + Element errorElement = msg.getElement(responseError); + std::string errMsg(""); + const Name messageTag("message"); + if (errorElement.hasElement(messageTag)) { + errMsg = errorElement.getElementAsString(messageTag); + } + Rcpp::Rcerr << "REQUEST FAILED: " << errorElement << std::endl; + throw std::logic_error("bdp result: a responseError was received with message: (" + errMsg + ")"); + } + Element securityData = response.getElement(Name{"securityData"}); for (size_t i = 0; i < securityData.numValues(); ++i) {