mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
More error catching, copy error in JsonRequest to able to return it to caller and send it per email
This commit is contained in:
parent
9e049d8477
commit
ef1e7e80eb
@ -52,7 +52,12 @@ void JsonRequestHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Po
|
||||
Poco::Dynamic::Var parsedResult = parseJsonWithErrorPrintFile(request_stream);
|
||||
|
||||
if (parsedResult.size() != 0) {
|
||||
json_result = handle(parsedResult);
|
||||
try {
|
||||
json_result = handle(parsedResult);
|
||||
}
|
||||
catch (Poco::Exception& ex) {
|
||||
json_result = stateError("poco Exception in handle POST Request", ex.displayText());
|
||||
}
|
||||
}
|
||||
else {
|
||||
json_result = stateError("empty body");
|
||||
@ -61,7 +66,12 @@ void JsonRequestHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Po
|
||||
else if(method == "GET") {
|
||||
Poco::URI uri(request.getURI());
|
||||
auto queryParameters = uri.getQueryParameters();
|
||||
json_result = handle(queryParameters);
|
||||
try {
|
||||
json_result = handle(queryParameters);
|
||||
}
|
||||
catch (Poco::Exception& ex) {
|
||||
json_result = stateError("poco Exception in handle GET Request", ex.displayText());
|
||||
}
|
||||
}
|
||||
|
||||
if (json_result) {
|
||||
|
||||
@ -121,7 +121,7 @@ JsonRequestReturn JsonRequest::request(const char* methodName, const Poco::JSON:
|
||||
if (!object.isNull("details")) {
|
||||
addError(new ParamError(functionName, "details:", object.get("details").convert<std::string>().data()));
|
||||
}
|
||||
sendErrorsAsEmail();
|
||||
sendErrorsAsEmail("", true);
|
||||
return JSON_REQUEST_RETURN_ERROR;
|
||||
}
|
||||
else if (stateString == "success") {
|
||||
|
||||
@ -42,7 +42,12 @@ namespace model
|
||||
{
|
||||
UNIQUE_LOCK;
|
||||
std::stringstream ss;
|
||||
result->stringify(ss);
|
||||
try {
|
||||
result->stringify(ss);
|
||||
}
|
||||
catch (Poco::Exception& ex) {
|
||||
addError(new ParamError("PendingTask::setResultJson", "exception by json -> string", ex.displayText()));
|
||||
}
|
||||
mResultJsonString = ss.str();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user