} catch (const std::exception& ex) {
HttpUtility::SendJsonError(response, params, 404,
"No objects found.",
- HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
+ DiagnosticInformation(ex));
return true;
}
} else {
Log(LogNotice, "ApiActionHandler")
<< "Running action " << actionName;
+ bool verbose = false;
+
+ if (params)
+ verbose = HttpUtility::GetLastParameter(params, "verbose");
+
for (const ConfigObject::Ptr& obj : objs) {
try {
results.emplace_back(action->Invoke(obj, params));
{ "status", "Action execution failed: '" + DiagnosticInformation(ex, false) + "'." }
});
- if (HttpUtility::GetLastParameter(params, "verboseErrors"))
- fail->Set("diagnostic information", DiagnosticInformation(ex));
+ /* Exception for actions. Normally we would handle this inside SendJsonError(). */
+ if (verbose)
+ fail->Set("diagnostic_information", DiagnosticInformation(ex));
results.emplace_back(std::move(fail));
}