36#ifndef INCLUDED_BLPAPI_EXCEPTION
37#define INCLUDED_BLPAPI_EXCEPTION
111#ifndef INCLUDED_BLPAPI_DEFS
115#ifndef INCLUDED_BLPAPI_ERROR
135struct blpapi_ErrorInfo {
137 char description[256];
140typedef struct blpapi_ErrorInfo blpapi_ErrorInfo_t;
143int blpapi_getErrorInfo(blpapi_ErrorInfo_t *buffer,
int errorCode);
152#ifndef INCLUDED_EXCEPTION
154#define INCLUDED_EXCEPTION
157#ifndef INCLUDED_STRING
159#define INCLUDED_STRING
181 const std::string d_description;
201 virtual const char *
what()
const throw();
375 static void throwException(
int errorCode);
401 : d_description(newDescription)
409 return d_description;
422 const std::string& newDescription)
432 const std::string& newDescription)
442 const std::string& newDescription)
452 const std::string& newDescription)
462 const std::string& newDescription)
472 const std::string& newDescription)
482 const std::string& newDescription)
492 const std::string& newDescription)
510inline void ExceptionUtil::throwException(
int errorCode)
512 const char *description = blpapi_getLastErrorDescription(errorCode);
514 description =
"Unknown";
517 if (BLPAPI_ERROR_DUPLICATE_CORRELATIONID == errorCode) {
518 throw DuplicateCorrelationIdException(description);
521 switch (BLPAPI_RESULTCLASS(errorCode))
522 case BLPAPI_INVALIDSTATE_CLASS: {
523 throw InvalidStateException(description);
524 case BLPAPI_INVALIDARG_CLASS:
525 throw InvalidArgumentException(description);
526 case BLPAPI_CNVERROR_CLASS:
527 throw InvalidConversionException(description);
528 case BLPAPI_BOUNDSERROR_CLASS:
529 throw IndexOutOfRangeException(description);
530 case BLPAPI_FLDNOTFOUND_CLASS:
531 throw FieldNotFoundException(description);
532 case BLPAPI_UNSUPPORTED_CLASS:
533 throw UnsupportedOperationException(description);
534 case BLPAPI_NOTFOUND_CLASS:
535 throw NotFoundException(description);
537 throw Exception(description);
544 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:421
Definition blpapi_exception.h:372
static void throwOnError(int errorCode)
Definition blpapi_exception.h:541
Exception(const std::string &description)
Definition blpapi_exception.h:400
virtual const char * what() const
Definition blpapi_exception.h:412
const std::string & description() const
Definition blpapi_exception.h:407
virtual ~Exception()
Definition blpapi_exception.h:405
FieldNotFoundException(const std::string &description)
Definition blpapi_exception.h:471
IndexOutOfRangeException(const std::string &description)
Definition blpapi_exception.h:461
InvalidArgumentException(const std::string &description)
Definition blpapi_exception.h:441
InvalidConversionException(const std::string &description)
Definition blpapi_exception.h:451
InvalidStateException(const std::string &description)
Definition blpapi_exception.h:431
NotFoundException(const std::string &description)
Definition blpapi_exception.h:501
UnknownErrorException(const std::string &description)
Definition blpapi_exception.h:481
UnsupportedOperationException(const std::string &description)
Definition blpapi_exception.h:491
Definition blpapi_abstractsession.h:211