c++: avoid slicing exception

Newer clang (or was it gcc?) warn about catching exceptions by value
which have virtual methods. This shouldn't have mattered here because
the exception values where not really used, but using a const
reference is better nonetheless.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
This commit is contained in:
Patrick Ohly 2020-03-02 04:24:24 -08:00
parent 0e5ee4f41a
commit b2b1f2f161
2 changed files with 4 additions and 4 deletions

View File

@ -3746,7 +3746,7 @@ SyncMLStatus SyncContext::doSync()
bool status = true;
try {
status = sendSAN (version);
} catch (TransportException e) {
} catch (const TransportException &e) {
if (!sanFormat.empty()){
throw;
}
@ -4590,11 +4590,11 @@ bool SyncContext::checkForScriptAbort(SharedSession session)
SharedKey contextKey = m_engine.OpenKeyByPath(sessionKey, "/sessionvars");
bool abort = m_engine.GetInt32Value(contextKey, "delayedabort");
return abort;
} catch (NoSuchKey) {
} catch (const NoSuchKey &) {
// this is necessary because the session might already have
// been closed, which removes the variable
return false;
} catch (BadSynthesisResult) {
} catch (const BadSynthesisResult &) {
return false;
}
}

View File

@ -445,7 +445,7 @@ int main(int argc, char* argv[])
}
ClientTest::shutdown();
return failed;
} catch (invalid_argument e) {
} catch (const invalid_argument &e) {
// Test path not resolved
std::cout << std::endl
<< "ERROR: " << e.what()