Merge pull request #28484 from taosdata/fix/TD-32665-2

fix(az/stream): catch all exceptions from cpp
This commit is contained in:
Shengliang Guan 2024-10-25 09:44:10 +08:00 committed by GitHub
commit 6701066ad8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 1 deletions

View File

@ -416,7 +416,7 @@ _exit:
return 0; return 0;
} }
int32_t azGetObjectToFile(const char *object_name, const char *fileName) { static int32_t azGetObjectToFileImpl(const char *object_name, const char *fileName) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
std::string accountName = tsS3AccessKeyId[0]; std::string accountName = tsS3AccessKeyId[0];
std::string accountKey = tsS3AccessKeySecret[0]; std::string accountKey = tsS3AccessKeySecret[0];
@ -450,6 +450,23 @@ int32_t azGetObjectToFile(const char *object_name, const char *fileName) {
TAOS_RETURN(code); TAOS_RETURN(code);
} }
int32_t azGetObjectToFile(const char *object_name, const char *fileName) {
int32_t code = 0;
try {
code = azGetObjectToFileImpl(object_name, fileName);
} catch (const std::exception &e) {
azError("%s: Reason Phrase: %s", __func__, e.what());
code = TAOS_SYSTEM_ERROR(EIO);
azError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
TAOS_RETURN(code);
}
TAOS_RETURN(code);
}
int32_t azGetObjectsByPrefix(const char *prefix, const char *path) { int32_t azGetObjectsByPrefix(const char *prefix, const char *path) {
const std::string delimiter = "/"; const std::string delimiter = "/";
std::string accountName = tsS3AccessKeyId[0]; std::string accountName = tsS3AccessKeyId[0];