FilterCmpt: return error when no db entries

This commit is contained in:
cgfhtw
2024-03-06 09:59:19 +01:00
parent 798a4a388b
commit c68e3466e2
3 changed files with 22 additions and 2 deletions
@@ -41,7 +41,14 @@ class Filter extends FHC_Controller
*/
public function getFilter()
{
$this->outputJsonSuccess($this->filtercmptlib->getSession());
$session = $this->filtercmptlib->getSession();
if (is_object($session)) {
// If stdClass it is an retval object
if (isError($session))
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
$this->outputJson($session);
} else
$this->outputJsonSuccess($session);
}
/**
+11
View File
@@ -176,6 +176,12 @@ class FilterCmptLib
// Read the all session for this filter component
$session = $this->getSession();
// Was there an error before?
if (is_object($session)) {
$this->_setSession(null);
$session = null;
}
// If session is NOT empty -> a filter was already loaded
if ($session != null)
{
@@ -266,6 +272,11 @@ class FilterCmptLib
);
}
}
else
{
$this->_setSession(error('Entries in the DB missing!'));
return;
}
}
// NOTE: latest operations to be performed in the session to be shure that they are always present
+3 -1
View File
@@ -296,7 +296,9 @@ export const CoreFilterCmpt = {
}
else
{
console.error(CoreRESTClient.getError(response));
// NOTE(chris): this should never happen -> error should have been
// catched before by the Fetch component.
console.error(response.retval);
}
},
/**