diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache index 3f7f4e0b7402..cfb88ec33158 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache @@ -83,7 +83,7 @@ void {{classname}}::{{operationIdSnakeCase}}_handler(const Pistache::Rest::Reque //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-source.mustache index f08981eff5a6..82b4e2d81ef6 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-source.mustache @@ -39,7 +39,7 @@ bool fromStringValue(const std::string &inStr, int32_t &value){ try { value = std::stoi( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true; @@ -49,7 +49,7 @@ bool fromStringValue(const std::string &inStr, int64_t &value){ try { value = std::stol( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true; @@ -65,7 +65,7 @@ bool fromStringValue(const std::string &inStr, float &value){ try { value = std::stof( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true; @@ -75,7 +75,7 @@ bool fromStringValue(const std::string &inStr, double &value){ try { value = std::stod( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true; diff --git a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION index d96260ba335d..479c313e87b9 100644 --- a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION +++ b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.2-SNAPSHOT \ No newline at end of file +4.0.3-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/cpp-pistache/api/PetApi.cpp b/samples/server/petstore/cpp-pistache/api/PetApi.cpp index 5ef93e9f73e2..2dcf3b1434b8 100644 --- a/samples/server/petstore/cpp-pistache/api/PetApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/PetApi.cpp @@ -58,7 +58,7 @@ void PetApi::add_pet_handler(const Pistache::Rest::Request &request, Pistache::H //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -78,7 +78,7 @@ void PetApi::delete_pet_handler(const Pistache::Rest::Request &request, Pistache //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -103,7 +103,7 @@ void PetApi::find_pets_by_status_handler(const Pistache::Rest::Request &request, //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -128,7 +128,7 @@ void PetApi::find_pets_by_tags_handler(const Pistache::Rest::Request &request, P //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -145,7 +145,7 @@ void PetApi::get_pet_by_id_handler(const Pistache::Rest::Request &request, Pista //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -165,7 +165,7 @@ void PetApi::update_pet_handler(const Pistache::Rest::Request &request, Pistache //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -179,7 +179,7 @@ void PetApi::update_pet_with_form_handler(const Pistache::Rest::Request &request //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -193,7 +193,7 @@ void PetApi::upload_file_handler(const Pistache::Rest::Request &request, Pistach //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; diff --git a/samples/server/petstore/cpp-pistache/api/StoreApi.cpp b/samples/server/petstore/cpp-pistache/api/StoreApi.cpp index 6987e9cc8538..b9ae6c1d58f3 100644 --- a/samples/server/petstore/cpp-pistache/api/StoreApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/StoreApi.cpp @@ -51,7 +51,7 @@ void StoreApi::delete_order_handler(const Pistache::Rest::Request &request, Pist //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -66,7 +66,7 @@ void StoreApi::get_inventory_handler(const Pistache::Rest::Request &request, Pis //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -83,7 +83,7 @@ void StoreApi::get_order_by_id_handler(const Pistache::Rest::Request &request, P //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -103,7 +103,7 @@ void StoreApi::place_order_handler(const Pistache::Rest::Request &request, Pista //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; diff --git a/samples/server/petstore/cpp-pistache/api/UserApi.cpp b/samples/server/petstore/cpp-pistache/api/UserApi.cpp index f64232454a2c..76846eb5ec64 100644 --- a/samples/server/petstore/cpp-pistache/api/UserApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/UserApi.cpp @@ -58,7 +58,7 @@ void UserApi::create_user_handler(const Pistache::Rest::Request &request, Pistac //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -77,7 +77,7 @@ void UserApi::create_users_with_array_input_handler(const Pistache::Rest::Reques //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -96,7 +96,7 @@ void UserApi::create_users_with_list_input_handler(const Pistache::Rest::Request //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -113,7 +113,7 @@ void UserApi::delete_user_handler(const Pistache::Rest::Request &request, Pistac //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -130,7 +130,7 @@ void UserApi::get_user_by_name_handler(const Pistache::Rest::Request &request, P //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -163,7 +163,7 @@ void UserApi::login_user_handler(const Pistache::Rest::Request &request, Pistach //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -178,7 +178,7 @@ void UserApi::logout_user_handler(const Pistache::Rest::Request &request, Pistac //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; @@ -200,7 +200,7 @@ void UserApi::update_user_handler(const Pistache::Rest::Request &request, Pistac //send a 400 error response.send(Pistache::Http::Code::Bad_Request, e.what()); return; - } catch (std::runtime_error &e) { + } catch (std::exception &e) { //send a 500 error response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); return; diff --git a/samples/server/petstore/cpp-pistache/model/Helpers.cpp b/samples/server/petstore/cpp-pistache/model/Helpers.cpp index b518f8106d77..a7774194c82c 100644 --- a/samples/server/petstore/cpp-pistache/model/Helpers.cpp +++ b/samples/server/petstore/cpp-pistache/model/Helpers.cpp @@ -50,7 +50,7 @@ bool fromStringValue(const std::string &inStr, int32_t &value){ try { value = std::stoi( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true; @@ -60,7 +60,7 @@ bool fromStringValue(const std::string &inStr, int64_t &value){ try { value = std::stol( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true; @@ -76,7 +76,7 @@ bool fromStringValue(const std::string &inStr, float &value){ try { value = std::stof( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true; @@ -86,7 +86,7 @@ bool fromStringValue(const std::string &inStr, double &value){ try { value = std::stod( inStr ); } - catch (const std::invalid_argument) { + catch (const std::invalid_argument&) { return false; } return true;