return (isc::config::createAnswer(1, "Unrecognized command:"
+ command));
- } catch (const Exception& ex) {
+ } catch (const isc::Exception& ex) {
return (isc::config::createAnswer(1, "Error while processing command '"
+ command + "':" + ex.what() +
", params: '" + txt + "'"));
return (isc::config::createAnswer(1, "Unrecognized command:"
+ command));
- } catch (const Exception& ex) {
+ } catch (const isc::Exception& ex) {
return (isc::config::createAnswer(1, "Error while processing command '"
+ command + "':" + ex.what() +
", params: '" + txt + "'"));
try {
drop_time_[drop_time_set_] =
boost::lexical_cast<double>(optarg);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(isc::InvalidParameter,
"value of drop time: -d<value>"
" must be positive number");
try {
drop_percent =
boost::lexical_cast<double>(drop_arg.substr(0, percent_loc));
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(isc::InvalidParameter,
"value of drop percentage: -D<value%>"
" must be 0..100");
try {
code = boost::lexical_cast<int>(opt_text.substr(0,coma_loc));
check(code <= 0, "Option code can't be negative");
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(InvalidParameter, "Invalid option code specified for "
"-o option, expected format: -o<integer>,<hexstring>");
}
std::vector<uint8_t> bin;
try {
isc::util::encode::decodeHex(opt_text, bin);
- } catch (BadValue& e) {
+ } catch (const BadValue& e) {
isc_throw(InvalidParameter, "Error during encoding option -o:"
<< e.what());
}
long long clients_num = boost::lexical_cast<long long>(optarg);
check(clients_num < 0, errmsg);
clients_num_ = boost::lexical_cast<uint32_t>(optarg);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(isc::InvalidParameter, errmsg);
}
}
try {
// Do actual conversion
ui = convertHexString(token);
- } catch (isc::InvalidParameter&) {
+ } catch (const isc::InvalidParameter&) {
isc_throw(isc::InvalidParameter,
"invalid characters in MAC provided");
try {
// Do actual conversion
ui = convertHexString(b.substr(i, 2));
- } catch (isc::InvalidParameter&) {
+ } catch (const isc::InvalidParameter&) {
isc_throw(isc::InvalidParameter,
"invalid characters in DUID provided,"
" expected hex digits");
try {
// Do actual conversion
ui = convertHexString(token);
- } catch (isc::InvalidParameter&) {
+ } catch (const isc::InvalidParameter&) {
return (true);
}
// If conversion succeeded store byte value
int value = boost::lexical_cast<int>(optarg);
check(value <= 0, errmsg);
return (value);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(InvalidParameter, errmsg);
}
}
int value = boost::lexical_cast<int>(optarg);
check(value < 0, errmsg);
return (value);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(InvalidParameter, errmsg);
}
}
-// Copyright (C) 2012-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
if (command_options.parse(argc, argv, true)) {
return (ret_code);
}
- } catch(isc::Exception& e) {
+ } catch (const isc::Exception& e) {
ret_code = 1;
command_options.usage();
std::cerr << "\nERROR: parsing command line options: "
AvalancheScen scen(command_options, socket);
ret_code = scen.run();
}
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
ret_code = 1;
std::cerr << "\nERROR: running perfdhcp: " << e.what() << std::endl;
if (diags.find('e') != std::string::npos) {
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
isc::data::ElementPtr elements;
try {
elements = isc::data::Element::fromJSON(user_string);
- } catch (isc::data::JSONError& ex) {
+ } catch (const isc::data::JSONError& ex) {
isc_throw(UserFileError,
"UserFile entry is malformed JSON: " << ex.what());
}
-// Copyright (C) 2011-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
socket_.async_send(boost::asio::buffer(send_buffer_->getData(),
send_buffer_->getLength()),
callback);
- } catch (boost::numeric::bad_numeric_cast&) {
+ } catch (const boost::numeric::bad_numeric_cast&) {
isc_throw(BufferTooLarge,
"attempt to send buffer larger than 64kB");
}
// ... and send it
socket_.async_send(boost::asio::buffer(send_buffer_->getData(),
send_buffer_->getLength()), callback);
- } catch (boost::numeric::bad_numeric_cast&) {
+ } catch (const boost::numeric::bad_numeric_cast&) {
isc_throw(BufferTooLarge,
"attempt to send buffer larger than 64kB");
}
-// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
data::ConstElementPtr command;
handle.getArgument("command", command);
cmd_name_ = parseCommand(cmd_args_, command);
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
isc_throw(isc::BadValue, "JSON command text is invalid: " << ex.what());
}
}
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
std::string queue_type ;
try {
queue_type = data::SimpleParser::getString(parameters, "queue-type");
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
isc_throw(InvalidQueueParameter, "queue-type missing or invalid: " << ex.what());
}
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
std::string queue_type ;
try {
queue_type = data::SimpleParser::getString(parameters, "queue-type");
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
isc_throw(InvalidQueueParameter,
"queue-type missing or invalid: " << ex.what());
}
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
std::string queue_type ;
try {
queue_type = data::SimpleParser::getString(parameters, "queue-type");
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
isc_throw(InvalidQueueParameter,
"queue-type missing or invalid: " << ex.what());
}
-// Copyright (C) 2013-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// NameChangeRequest instance. Note the factory may throw
// NcrMessageError.
ncr = NameChangeRequest::fromJSON(string_data);
- } catch (isc::util::InvalidBufferPosition& ex) {
+ } catch (const isc::util::InvalidBufferPosition& ex) {
// Read error accessing data in InputBuffer.
isc_throw(NcrMessageError, "fromFormat: buffer read error: "
<< ex.what());
isc::data::ElementPtr elements;
try {
elements = isc::data::Element::fromJSON(json);
- } catch (isc::data::JSONError& ex) {
+ } catch (const isc::data::JSONError& ex) {
isc_throw(NcrMessageError,
"Malformed NameChangeRequest JSON: " << ex.what());
}
try {
// Get the element's integer value.
raw_value = element->intValue();
- } catch (isc::data::TypeError& ex) {
+ } catch (const isc::data::TypeError& ex) {
// We expect a integer Element type, don't have one.
isc_throw(NcrMessageError,
"Wrong data type for change_type: " << ex.what());
try {
// Get the element's boolean value.
value = element->boolValue();
- } catch (isc::data::TypeError& ex) {
+ } catch (const isc::data::TypeError& ex) {
// We expect a boolean Element type, don't have one.
isc_throw(NcrMessageError,
"Wrong data type for forward-change: " << ex.what());
try {
// Get the element's boolean value.
value = element->boolValue();
- } catch (isc::data::TypeError& ex) {
+ } catch (const isc::data::TypeError& ex) {
// We expect a boolean Element type, don't have one.
isc_throw(NcrMessageError,
"Wrong data type for reverse_change: " << ex.what());
NameChangeRequest::setLeaseExpiresOn(const std::string& value) {
try {
lease_expires_on_ = isc::util::timeFromText64(value);
- } catch(...) {
+ } catch (...) {
// We were given an invalid string, so throw.
isc_throw(NcrMessageError,
"Invalid date-time string: [" << value << "]");
try {
// Get the element's integer value.
value = element->intValue();
- } catch (isc::data::TypeError& ex) {
+ } catch (const isc::data::TypeError& ex) {
// We expect a integer Element type, don't have one.
isc_throw(NcrMessageError,
"Wrong data type for lease_length: " << ex.what());
-// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// Bind the low level socket to our endpoint.
asio_socket_->bind(endpoint.getASIOEndpoint());
- } catch (boost::system::system_error& ex) {
+ } catch (const boost::system::system_error& ex) {
asio_socket_.reset();
isc_throw (NcrUDPError, ex.code().message());
}
if (asio_socket_->is_open()) {
try {
asio_socket_->close();
- } catch (boost::system::system_error& ex) {
+ } catch (const boost::system::system_error& ex) {
// It is really unlikely that this will occur.
// If we do reopen later it will be with a new socket
// instance. Repackage exception as one that is conformant
// Bind the low level socket to our endpoint.
asio_socket_->bind(endpoint.getASIOEndpoint());
- } catch (boost::system::system_error& ex) {
+ } catch (const boost::system::system_error& ex) {
isc_throw (NcrUDPError, ex.code().message());
}
if (asio_socket_->is_open()) {
try {
asio_socket_->close();
- } catch (boost::system::system_error& ex) {
+ } catch (const boost::system::system_error& ex) {
// It is really unlikely that this will occur.
// If we do reopen later it will be with a new socket
// instance. Repackage exception as one that is conformant
lease->setContext(ctx);
}
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
// bump the read error count
++read_errs_;
if (ctx) {
lease->setContext(ctx);
}
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
// bump the read error count
++read_errs_;
uint32_t max_row_errors = 0;
try {
max_row_errors = boost::lexical_cast<uint32_t>(max_row_errors_str);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(isc::BadValue, "invalid value of the max-row-errors "
<< max_row_errors_str << " specified");
}
uint32_t lfc_interval = 0;
try {
lfc_interval = boost::lexical_cast<uint32_t>(lfc_interval_str);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
isc_throw(isc::BadValue, "invalid value of the lfc-interval "
<< lfc_interval_str << " specified");
}
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
<< "' option space name is reserved for DHCPv6 server");
}
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
// Append position of the option space parameter.
isc_throw(DhcpConfigError, ex.what() << " ("
<< getPosition("space", parent) << ")");
-// Copyright (C) 2009-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2009-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
TEST_F(ExceptionTest, basicMethods) {
try {
isc_throw(Exception, teststring);
- } catch (Exception& ex) {
+ } catch (const Exception& ex) {
EXPECT_EQ(ex.getMessage(), std::string(teststring));
EXPECT_EQ(ex.getFile(), std::string(__FILE__));
EXPECT_EQ(ex.getLine(), __LINE__ - 4);
TEST_F(ExceptionTest, string) {
try {
isc_throw(Exception, std::string(teststring));
- } catch (Exception& ex) {
+ } catch (const Exception& ex) {
EXPECT_EQ(ex.getMessage(), std::string(teststring));
EXPECT_EQ(ex.getFile(), std::string(__FILE__));
EXPECT_EQ(ex.getLine(), __LINE__ - 4);
TEST_F(ExceptionTest, stdInheritance) {
try {
isc_throw(Exception, teststring);
- } catch (std::exception& ex) {
+ } catch (const std::exception& ex) {
EXPECT_EQ(std::string(ex.what()), std::string(teststring));
}
}
-// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
}
return convertFromBindLevel(Level(DEBUG, dbglevel));
}
- catch (boost::bad_lexical_cast&) {
+ catch (const boost::bad_lexical_cast&) {
LOG_ERROR(logger, LOGIMPL_BAD_DEBUG_STRING).arg(name);
return (NOT_SET_LOG_LEVEL);
}
-// Copyright (C) 2011-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
logger.warn(LOG_NO_SUCH_MESSAGE).arg(message_id);
}
}
- catch (MessageException& e) {
+ catch (const MessageException& e) {
MessageID ident = e.id();
vector<string> args = e.arguments();
-// Copyright (C) 2011-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
}
try {
cur_opt.maxver = boost::lexical_cast<unsigned int>(optarg);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
std::cerr << "Maximum version (-m) argument must be a positive "
"integer\n";
return (1);
}
try {
cur_opt.maxsize = boost::lexical_cast<size_t>(optarg);
- } catch (boost::bad_lexical_cast&) {
+ } catch (const boost::bad_lexical_cast&) {
std::cerr << "File size (-z) argument must be a positive "
"integer\n";
return (1);
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
reader.processLine(what);
FAIL() << "MessageReader::processLine() should throw an exception " <<
" with message ID " << expected << " for '" << what << "'\n";
- } catch (MessageException& e) {
+ } catch (const MessageException& e) {
EXPECT_EQ(boost::lexical_cast<string>(expected),
boost::lexical_cast<string>(e.id()));
} catch (...) {
// Check that stream is "ready" for any IO operations.
checkStreamStatusAndReset("get next row");
- } catch (isc::Exception& ex) {
+ } catch (const isc::Exception& ex) {
setReadMsg(ex.what());
return (false);
}