show error when action command fails

This commit is contained in:
proddy
2025-02-02 13:29:18 +01:00
parent 2378fb547c
commit 0bb61b4296

View File

@@ -204,12 +204,14 @@ void WebStatusService::action(AsyncWebServerRequest * request, JsonVariant json)
Serial.println(COLOR_RESET); Serial.println(COLOR_RESET);
#endif #endif
// send response // check for error
if (!ok) { if (!ok) {
request->send(400); emsesp::EMSESP::logger().err("Action '%s' failed", action.c_str());
request->send(400); // bad request
return; return;
} }
// send response
response->setLength(); response->setLength();
request->send(response); request->send(response);
} }
@@ -256,7 +258,7 @@ bool WebStatusService::checkUpgrade(JsonObject root, std::string & versions) {
} }
// action = allvalues // action = allvalues
// output all the devices and the values // output all the devices and their values, including custom entities, scheduler and sensors
void WebStatusService::allvalues(JsonObject output) { void WebStatusService::allvalues(JsonObject output) {
JsonObject device_output; JsonObject device_output;
auto value = F_(values); auto value = F_(values);