From: Hang Li Date: Tue, 3 Sep 2019 03:53:14 +0000 (+0800) Subject: test/erasure-code: add exception handling to k & m X-Git-Tag: v15.1.0~1638^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9f4dd107f834af5c70cf64b70e5310b5ea79e5db;p=ceph.git test/erasure-code: add exception handling to k & m Signed-off-by: Hang Li --- diff --git a/src/test/erasure-code/ceph_erasure_code_benchmark.cc b/src/test/erasure-code/ceph_erasure_code_benchmark.cc index 4a810c7ebe32..2bcb5f3cd3b0 100644 --- a/src/test/erasure-code/ceph_erasure_code_benchmark.cc +++ b/src/test/erasure-code/ceph_erasure_code_benchmark.cc @@ -121,10 +121,15 @@ int ErasureCodeBench::setup(int argc, char** argv) { exhaustive_erasures = false; if (vm.count("erased") > 0) erased = vm["erased"].as >(); - - k = stoi(profile["k"]); - m = stoi(profile["m"]); + try { + k = stoi(profile["k"]); + m = stoi(profile["m"]); + } catch (const std::logic_error& e) { + cout << "Invalid k and/or m: k=" << profile["k"] << ", m=" << profile["m"] + << " (" << e.what() << ")" << endl; + return -EINVAL; + } if (k <= 0) { cout << "parameter k is " << k << ". But k needs to be > 0." << endl; return -EINVAL;