Check for verbose error handling in SendJsonError()

This commit is contained in:
Michael Friedrich 2018-04-05 17:17:06 +02:00
parent 3a8017fd99
commit 1dd8409691
1 changed files with 9 additions and 2 deletions

View File

@ -89,11 +89,18 @@ void HttpUtility::SendJsonError(HttpResponse& response, const Dictionary::Ptr& p
response.SetStatus(code, HttpUtility::GetErrorNameByCode(code));
result->Set("error", code);
bool verbose = false;
if (params)
verbose = HttpUtility::GetLastParameter(params, "verbose");
if (!info.IsEmpty())
result->Set("status", info);
if (!diagnosticInformation.IsEmpty())
result->Set("diagnostic information", diagnosticInformation);
if (verbose) {
if (!diagnosticInformation.IsEmpty())
result->Set("diagnostic_information", diagnosticInformation);
}
HttpUtility::SendJsonBody(response, params, result);
}