mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 05:34:48 +02:00
Check for verbose error handling in SendJsonError()
This commit is contained in:
parent
3a8017fd99
commit
1dd8409691
@ -89,11 +89,18 @@ void HttpUtility::SendJsonError(HttpResponse& response, const Dictionary::Ptr& p
|
|||||||
response.SetStatus(code, HttpUtility::GetErrorNameByCode(code));
|
response.SetStatus(code, HttpUtility::GetErrorNameByCode(code));
|
||||||
result->Set("error", code);
|
result->Set("error", code);
|
||||||
|
|
||||||
|
bool verbose = false;
|
||||||
|
|
||||||
|
if (params)
|
||||||
|
verbose = HttpUtility::GetLastParameter(params, "verbose");
|
||||||
|
|
||||||
if (!info.IsEmpty())
|
if (!info.IsEmpty())
|
||||||
result->Set("status", info);
|
result->Set("status", info);
|
||||||
|
|
||||||
if (!diagnosticInformation.IsEmpty())
|
if (verbose) {
|
||||||
result->Set("diagnostic information", diagnosticInformation);
|
if (!diagnosticInformation.IsEmpty())
|
||||||
|
result->Set("diagnostic_information", diagnosticInformation);
|
||||||
|
}
|
||||||
|
|
||||||
HttpUtility::SendJsonBody(response, params, result);
|
HttpUtility::SendJsonBody(response, params, result);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user