mirror of https://github.com/Icinga/icinga2.git
parent
8af6ad74c3
commit
c3dc3e6ec6
|
@ -64,8 +64,8 @@ bool ActionsHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& reques
|
|||
try {
|
||||
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
} catch (const std::exception& ex) {
|
||||
HttpUtility::SendJsonError(response, 400,
|
||||
"Type/Filter was required but not provided or was invalid.",
|
||||
HttpUtility::SendJsonError(response, 404,
|
||||
"No objects found.",
|
||||
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,16 @@ bool DeleteObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
|
|||
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
||||
}
|
||||
|
||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
std::vector<Value> objs;
|
||||
|
||||
try {
|
||||
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
} catch (const std::exception& ex) {
|
||||
HttpUtility::SendJsonError(response, 404,
|
||||
"No objects found.",
|
||||
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cascade = HttpUtility::GetLastParameter(params, "cascade");
|
||||
|
||||
|
|
|
@ -59,7 +59,16 @@ bool ModifyObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
|
|||
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
||||
}
|
||||
|
||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
std::vector<Value> objs;
|
||||
|
||||
try {
|
||||
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
} catch (const std::exception& ex) {
|
||||
HttpUtility::SendJsonError(response, 404,
|
||||
"No objects found.",
|
||||
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
Dictionary::Ptr attrs = params->Get("attrs");
|
||||
|
||||
|
|
|
@ -142,7 +142,16 @@ bool ObjectQueryHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& re
|
|||
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
||||
}
|
||||
|
||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
std::vector<Value> objs;
|
||||
|
||||
try {
|
||||
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
} catch (const std::exception& ex) {
|
||||
HttpUtility::SendJsonError(response, 404,
|
||||
"No objects found.",
|
||||
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
Array::Ptr results = new Array();
|
||||
results->Reserve(objs.size());
|
||||
|
|
|
@ -92,7 +92,16 @@ bool StatusHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request
|
|||
if (request.RequestUrl->GetPath().size() >= 3)
|
||||
params->Set("status", request.RequestUrl->GetPath()[2]);
|
||||
|
||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
std::vector<Value> objs;
|
||||
|
||||
try {
|
||||
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
} catch (const std::exception& ex) {
|
||||
HttpUtility::SendJsonError(response, 404,
|
||||
"No objects found.",
|
||||
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
Array::Ptr results = Array::FromVector(objs);
|
||||
|
||||
|
|
|
@ -97,7 +97,16 @@ bool TypeQueryHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& requ
|
|||
if (request.RequestUrl->GetPath().size() >= 3)
|
||||
params->Set("name", request.RequestUrl->GetPath()[2]);
|
||||
|
||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
std::vector<Value> objs;
|
||||
|
||||
try {
|
||||
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||
} catch (const std::exception& ex) {
|
||||
HttpUtility::SendJsonError(response, 404,
|
||||
"No objects found.",
|
||||
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||
return true;
|
||||
}
|
||||
|
||||
Array::Ptr results = new Array();
|
||||
|
||||
|
|
Loading…
Reference in New Issue