38#ifndef INCLUDED_BLPAPI_EXCEPTION
39#define INCLUDED_BLPAPI_EXCEPTION
131struct blpapi_ErrorInfo {
133 char description[256];
136typedef struct blpapi_ErrorInfo blpapi_ErrorInfo_t;
166int blpapi_getErrorInfo(blpapi_ErrorInfo_t *buffer,
int errorCode);
196 const std::string d_description;
216 virtual const char *
what()
const throw();
390 static void throwException(
int errorCode);
416 : d_description(newDescription)
424 return d_description;
437 const std::string& newDescription)
447 const std::string& newDescription)
457 const std::string& newDescription)
467 const std::string& newDescription)
477 const std::string& newDescription)
487 const std::string& newDescription)
497 const std::string& newDescription)
507 const std::string& newDescription)
525inline void ExceptionUtil::throwException(
int errorCode)
527 const char *description = blpapi_getLastErrorDescription(errorCode);
529 description =
"Unknown";
532 if (BLPAPI_ERROR_DUPLICATE_CORRELATIONID == errorCode) {
533 throw DuplicateCorrelationIdException(description);
536 switch (BLPAPI_RESULTCLASS(errorCode))
537 case BLPAPI_INVALIDSTATE_CLASS: {
538 throw InvalidStateException(description);
539 case BLPAPI_INVALIDARG_CLASS:
540 throw InvalidArgumentException(description);
541 case BLPAPI_CNVERROR_CLASS:
542 throw InvalidConversionException(description);
543 case BLPAPI_BOUNDSERROR_CLASS:
544 throw IndexOutOfRangeException(description);
545 case BLPAPI_FLDNOTFOUND_CLASS:
546 throw FieldNotFoundException(description);
547 case BLPAPI_UNSUPPORTED_CLASS:
548 throw UnsupportedOperationException(description);
549 case BLPAPI_NOTFOUND_CLASS:
550 throw NotFoundException(description);
552 throw Exception(description);
559 throwException(errorCode);
Common definitions used by the library.
Provide a collection of errors that library can return.
DuplicateCorrelationIdException(const std::string &description)
Definition blpapi_exception.h:436
Definition blpapi_exception.h:387
static void throwOnError(int errorCode)
Definition blpapi_exception.h:556
Exception(const std::string &description)
Definition blpapi_exception.h:415
virtual const char * what() const
Definition blpapi_exception.h:427
const std::string & description() const
Definition blpapi_exception.h:422
virtual ~Exception()
Definition blpapi_exception.h:420
FieldNotFoundException(const std::string &description)
Definition blpapi_exception.h:486
IndexOutOfRangeException(const std::string &description)
Definition blpapi_exception.h:476
InvalidArgumentException(const std::string &description)
Definition blpapi_exception.h:456
InvalidConversionException(const std::string &description)
Definition blpapi_exception.h:466
InvalidStateException(const std::string &description)
Definition blpapi_exception.h:446
NotFoundException(const std::string &description)
Definition blpapi_exception.h:516
UnknownErrorException(const std::string &description)
Definition blpapi_exception.h:496
UnsupportedOperationException(const std::string &description)
Definition blpapi_exception.h:506
Definition blpapi_abstractsession.h:452
Definition blpapi_abstractsession.h:451