mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +00:00
[C++][Pistache] Catch exception instead of runtime_error (#3225)
* [C++][Pistache] Replace runtime_error with std::exception * [C++][Pistache] Update Petstore sample * [C++][Pistache] Fix catch-value warning
This commit is contained in:
committed by
sunn
parent
7af2bc8dff
commit
68a5fa4c8b
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user