From 71fc5fb738ddc1f44ff9bb9fdd64e6eaae61493d Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Mon, 29 Oct 2018 15:38:39 +0200 Subject: [PATCH] exceptions: convert sprint() to format() sprint() recently became more strict, throwing on sprint("%s", 5). Replace with the more modern format(). Mechanically converted with https://github.com/avikivity/unsprint. --- exceptions/exceptions.cc | 2 +- exceptions/exceptions.hh | 4 ++-- exceptions/unrecognized_entity_exception.hh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exceptions/exceptions.cc b/exceptions/exceptions.cc index 2cfc657685..b4e8aaebf8 100644 --- a/exceptions/exceptions.cc +++ b/exceptions/exceptions.cc @@ -45,5 +45,5 @@ #include "log.hh" exceptions::truncate_exception::truncate_exception(std::exception_ptr ep) - : request_execution_exception(exceptions::exception_code::PROTOCOL_ERROR, sprint("Error during truncate: %s", ep)) + : request_execution_exception(exceptions::exception_code::PROTOCOL_ERROR, format("Error during truncate: {}", ep)) {} diff --git a/exceptions/exceptions.hh b/exceptions/exceptions.hh index 5bb1778b55..4e6b7f6109 100644 --- a/exceptions/exceptions.hh +++ b/exceptions/exceptions.hh @@ -282,11 +282,11 @@ private: { } public: already_exists_exception(sstring ks_name_, sstring cf_name_) - : already_exists_exception{ks_name_, cf_name_, sprint("Cannot add already existing table \"%s\" to keyspace \"%s\"", cf_name_, ks_name_)} + : already_exists_exception{ks_name_, cf_name_, format("Cannot add already existing table \"{}\" to keyspace \"{}\"", cf_name_, ks_name_)} { } already_exists_exception(sstring ks_name_) - : already_exists_exception{ks_name_, "", sprint("Cannot add existing keyspace \"%s\"", ks_name_)} + : already_exists_exception{ks_name_, "", format("Cannot add existing keyspace \"{}\"", ks_name_)} { } }; diff --git a/exceptions/unrecognized_entity_exception.hh b/exceptions/unrecognized_entity_exception.hh index 4293372461..fb6aa06433 100644 --- a/exceptions/unrecognized_entity_exception.hh +++ b/exceptions/unrecognized_entity_exception.hh @@ -69,7 +69,7 @@ public: * @param relation the entity relation */ unrecognized_entity_exception(::shared_ptr entity, cql3::relation_ptr relation) - : invalid_request_exception(sprint("Undefined name %s in where clause ('%s')", *entity, relation->to_string())) + : invalid_request_exception(format("Undefined name {} in where clause ('{}')", *entity, relation->to_string())) , entity(entity) , relation(relation) { }