Skip to content

Commit

Permalink
Merge pull request #41 from Kai-Zhang/master
Browse files Browse the repository at this point in the history
Add errno to string interface in sdk
  • Loading branch information
Kai-Zhang authored Jan 17, 2017
2 parents 0fdbc22 + 5e45ba9 commit dcc84fe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions sdk/ins_sdk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,31 @@ std::string InsSDK::StatusToString(int32_t status) {
return "UnKnown";
}

std::string InsSDK::ErrorToString(SDKError error) {
switch (error) {
case kOK:
return "Ok";
case kClusterDown:
return "ClusterDown";
case kNoSuchKey:
return "NoSuckKey";
case kTimeout:
return "Timeout";
case kLockFail:
return "LockFail";
case kCleanBinlogFail:
return "CleanBinlogFail";
case kUserExists:
return "UserExists";
case kPermissionDenied:
return "PermissionDenied";
case kPasswordError:
return "PasswordError";
case kUnknownUser:
return "UnknownUser";
}
return "Unknown";
}

bool InsSDK::Put(const std::string& key, const std::string& value, SDKError* error) {
std::vector<std::string> server_list;
Expand Down
1 change: 1 addition & 0 deletions sdk/ins_sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class InsSDK {
bool IsLoggedIn();
void RegisterSessionTimeout(void (*handle_session_timeout)(void*), void* ctx );
static std::string StatusToString(int32_t status);
static std::string ErrorToString(SDKError error);

private:
void Init(const std::vector<std::string>& members);
Expand Down

0 comments on commit dcc84fe

Please sign in to comment.