forked from loafle/openapi-generator-original
[C++][Pistache] Fix compile break, error handling (#9742)
* fix compilation break with validate function * fix error handling in handleParsingException bug caused all errors to be regarded as an internal server error * generate samples
This commit is contained in:
@@ -49,11 +49,13 @@ void UserApi::setupRoutes() {
|
||||
std::pair<Pistache::Http::Code, std::string> UserApi::handleParsingException(const std::exception& ex) const noexcept
|
||||
{
|
||||
try {
|
||||
throw ex;
|
||||
throw;
|
||||
} catch (nlohmann::detail::exception &e) {
|
||||
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
|
||||
} catch (org::openapitools::server::helpers::ValidationException &e) {
|
||||
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
|
||||
} catch (std::exception &e) {
|
||||
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user