Tech-Circle-48 commented on code in PR #48965:
URL: https://github.com/apache/doris/pull/48965#discussion_r2000093605


##########
cloud/src/meta-service/meta_service_resource.cpp:
##########
@@ -2777,13 +2777,24 @@ void 
MetaServiceImpl::get_stage(google::protobuf::RpcController* controller,
                 // find, use it stage prefix and id
                 found = true;
                 // get from internal stage
-                int idx = stoi(s.obj_info().id());
-                if (idx > instance.obj_info().size() || idx < 1) {
-                    LOG(WARNING) << "invalid idx: " << idx;
-                    code = MetaServiceCode::UNDEFINED_ERR;
-                    msg = "impossible, id invalid";
+                try {
+                    int idx = stoi(s.obj_info().id());
+                    if (idx > instance.obj_info().size() || idx < 1) {
+                        LOG(WARNING) << "invalid idx: " << idx;
+                        code = MetaServiceCode::UNDEFINED_ERR;
+                        msg = "impossible, id invalid";
+                        return;
+                    }
+                } catch (const std::invalid_argument& e) {
+                    LOG(WARNING) << "Invalid idx format: " << s.obj_info().id()
+                                 << ", error: " << e.what();
+                    return;
+                } catch (const std::out_of_range& e) {
+                    LOG(WARNING) << "Idx value out of range: " << 
s.obj_info().id()

Review Comment:
   It's been modified.



##########
cloud/src/meta-service/meta_service_resource.cpp:
##########
@@ -2777,13 +2777,24 @@ void 
MetaServiceImpl::get_stage(google::protobuf::RpcController* controller,
                 // find, use it stage prefix and id
                 found = true;
                 // get from internal stage
-                int idx = stoi(s.obj_info().id());
-                if (idx > instance.obj_info().size() || idx < 1) {
-                    LOG(WARNING) << "invalid idx: " << idx;
-                    code = MetaServiceCode::UNDEFINED_ERR;
-                    msg = "impossible, id invalid";
+                try {
+                    int idx = stoi(s.obj_info().id());
+                    if (idx > instance.obj_info().size() || idx < 1) {
+                        LOG(WARNING) << "invalid idx: " << idx;
+                        code = MetaServiceCode::UNDEFINED_ERR;
+                        msg = "impossible, id invalid";
+                        return;
+                    }
+                } catch (const std::invalid_argument& e) {
+                    LOG(WARNING) << "Invalid idx format: " << s.obj_info().id()

Review Comment:
   It's been modified



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to