SDK
SDK C++ v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

Error Handling #

SDK methods handle failure by throwing exceptions inheriting the kuzzleio::KuzzleException class, which in turn inherits the standard std::runtime_error class.

Members:

  • unsigned int status: error code, following HTTP Standards
  • const char * what() const;: returns the error message

You can find a detailed list of possible errors messages and statuses in the documentation API.
Just replace Error by Exception to find the exception name. (e.g. BadRequestError becomes kuzzleio::BadRequestException).

Example #

try {
  kuzzle->index->create("nyc-open-data");
} catch (kuzzleio::BadRequestException& e) {
  std::cout << "Status: " << e.status() << " Message: " << e.what() << std::endl;
  std::cout << "Try with another name!" << std::endl;
}