forked from loafle/openapi-generator-original
[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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user