From e407ef5a98ea0e376d462ee0ee5fcf68d521d99a Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sat, 20 Feb 2016 23:08:41 +0100 Subject: [PATCH] - controlapi/config: simplify error handling --- src/nhttpd/tuxboxapi/controlapi.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 3f86a22d0..3f73be8cf 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -3045,9 +3045,7 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh) { } else { if(!configFileName.empty()) - error = string_printf("no config defined for: %s", (hh->ParamList["config"]).c_str()); - else - error = "no config given"; + error = string_printf("no config defined for %s", (hh->ParamList["config"]).c_str()); } // write footer @@ -3059,14 +3057,8 @@ void CControlAPI::ConfigCGI(CyhookHandler *hh) { hh->WriteLn(hh->outCollection("config", result)); } } - else { - if (outType == json) { - hh->WriteLn(json_out_error(error)); - } - else { - hh->SendError(); - } - } + else + hh->SendError(error); delete Config; }